question

raghuram avatar image
raghuram asked

Error while attaching mdf

i am getting error while attaching mdf files to the data base I hope you will help me.

thank you

Regards Desai

administrationattach
3 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Please provide meaningful title with questions, and don't use text-speak - that saves the MODs a job, thanks.
0 Likes 0 ·
Please provide details of the error you are getting then I expect someone here will be able to help (please edit your question, or add a comment, if possible - rather than adding an "Answer"; thanks)
0 Likes 0 ·
yeah, based on the information you gave the only thing we can say is, you must be doing it wrong. :-)
0 Likes 0 ·

1 Answer

· Write an Answer
Håkan Winther avatar image
Håkan Winther answered
Based on your question, it could be anything, but one of the common misstakes is the lack of log file (LDF). In order to attach the MDF you need to have the LDF and any NDF:S (like files from a second filegroup) If you don't have the LDF you can attach with "ATTACH_REBUILD_LOG" option (SQL2008 and later) USE master GO CREATE DATABASE AdventureWorks ON PRIMARY (FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks.mdf') FOR ATTACH_REBUILD_LOG
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.