1751975 Members
5185 Online
108784 Solutions
New Discussion юеВ

Re: Sql Server 7

 
SOLVED
Go to solution
Ron Bromwell
Frequent Advisor

Sql Server 7

We had a problem with a virus. Had to reinstall our sql server database. I have the old mdf file and a backup done from enterprise manager. How can I get sql server to recognize the old database file?

the OS is NT 4.0

Thanks,
Ron
life's a journey, not a destination
2 REPLIES 2
Kurt Matthies
Valued Contributor
Solution

Re: Sql Server 7

Yes, you have to restore both data and log files for a database using the sp_attachdb command in Query Analyser.

If your database name is myDB, and the files are myDB_data.mdf and myDB_log.ldf

then the command would be:

sp_attach_db @dbname=N'myDB',@filename1=N'C:\mssql7\Data\myDB_data.mdf',@filename2=N'C:\mssql7\Data\myDB_log.ldf'

assuming that SQL is in the C:\mssql7 directory on your server.

If if ain't broke, don't fix it.
Kurt Matthies
Valued Contributor

Re: Sql Server 7

Yes, you have to restore both data and log files for a database using the sp_attach_db command in Query Analyser.

If your database name is myDB, and the files are myDB_data.mdf and myDB_log.ldf

then the command would be:

sp_attach_db @dbname=N'myDB',@filename1=N'C:\mssql7\Data\myDB_data.mdf',@filename2=N'C:\mssql7\Data\myDB_log.ldf'

assuming that SQL is in the C:\mssql7 directory on your server.

If if ain't broke, don't fix it.