Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing data 1

Status
Not open for further replies.

teroy

Programmer
Oct 17, 2000
67
AU
Hi there..I have databases on a copy of sql server(which is not working) which i want to copy over to another server. I thought it would be as easy as getting the *.mdf and *.ldf files for the particular database and putting it in the \mssql7\data directory but i'm missing a few steps along the way.

Can anyone point me in the right direction as to the best approach to get these files in. On the server(which is not working) i cannot connect and make exports to csv or another format...which is why i went straight for the files in the data directory

Thanks in advance
 
Hi There Teroy

You are halfway there already.
After you have put the files in the data directory of the new server, run the following to attach the database to the new server.

EXEC sp_attach_db @dbname = 'MyDb',
@filename1 = 'c:\mssql7\data\MyDb.mdf',
@filename2 = 'c:\mssql7\data\MyDb_log.ldf'


Hope This Helps
Bernadette
 
Thanks Bernadette..that worked perfectly :))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top