Pages

Social Icons

Monday 14 May 2012

Attatch a .MDF file without .Ldf file

When you want to add a mdf file which does ot have its corresponding ldf file then you can use the following command. This command will create the database and restore the mdf file.

sp_attach_single_file_db
           @dbname='AdventureWorks',
          @physname='D:\AdventureWorksLT2008_Data.mdf'

When I was using this command then I got One error i.e. "Access is denied". For solving this problem go to the physician location of the mdf file and right click --> Properties --> Security. Then click on edit and give the full control to this file. then this error will not come.


Thx,
RS

No comments:

Post a Comment