web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Microsoft SQL - How to attach database having only mdf file

a33ik Profile Picture a33ik 84,331 Most Valuable Professional
Quick trick - I had only mdf file of database without log file. Following t-sql script allowed me to attach mdf file to SQL:

sp_attach_single_file_db @dbname= 'NewDatabase', @physname= 'C:\Directory\DataBase.mdf'



After I run this script I have got several messages but database was restored and worked fine.

This was originally posted here.

Comments

*This post is locked for comments