Wednesday, 25 November 2009

Attaching a data file without the log file...

If you have a SQL data (mdf) file without the corresponding log (ldf) file, you can still attach the database to an instance. Use the sp_attach_single_file_db procedure as demonstrated below:



--To attach a .mdf file without its log file,


--use the following syntax



EXEC sp_attach_single_file_db @dbname = 'YourDBname',

@physname = N'd:\Database\Data\YourDBname.mdf'



For more details, including a list of arguments, please visit:

http://msdn.microsoft.com/en-us/library/ms174385.aspx

No comments:

Post a Comment