Tuesday, February 2, 2010

Moving SQL Database Files mdf and ldf


--check the location of the files
Use databasename
GoExec sp_helpfile



--detach the database name
Exec sp_detach_db 'databasename'
--copy the mdf and ldf files to the location
--attach the databasename
Exec sp_attach_db 'databasename',
'D:\sqldata\GPSBSBBVDat.mdf',
'G:\sqldata\GPSBSBBVLog.ldf'

No comments:

Post a Comment