I have an MDF file and no LDF files for a database created in MS SQL Server 2005. When I try to attach the MDF file to a different SQL Server, I get the following error messa
I hope it is easy to do so,
Execute the following query
sp_attach_single_file_db @dbname='dbname',@physname='C:\Database\dbname.MDF'
Where dbname
is you want to show in Object Explorer, where @physname
is the local filepath location of your mdf file.
Hope it will help someone, i done by above, got both structure and also data.
Tested in Sql Server 2000 and 2008. In Sql Server 2000 it is not working, but works perfectly in 2008.