CREATE DATABASE Northwind
ON (name= 'Northwind',
filename = 'C:\Northwind.mdf')
FOR ATTACH_REBUILD_LOG;
The query above will create a new database for you call "Northwind", all you have to do is specify the location of the .mdf file and the "FOR ATTACH_REBUILD_LOG" will rebuild the log for you. You might run into a "Access denied" error but it's a permissions issue. Make sure the user that is running the query has permission to the file.
No comments:
Post a Comment