Friday, March 30, 2012

Help opening .MDF file

I'm trying to follow the article

http://aspnet.4guysfromrolla.com/articles/031506-1.aspx. It gives a sample to download at the bottom which I did. I'm trying to take a look at the Stored Proc that were created in the PagingData.mdf. The only thing included in the App_Data folder is PagingData.mdf file. How can I open the DB or attach it to my SQL2005 server? There is no .ldf file included in thesample so the attaching is failing.

You have two possible options connect the MDF to Management Studio and see if you can access everything or Backup and Restore the database SQL Server will receate everything including stored procs and LDF. Hope this helps.

http://blogs.msdn.com/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx

|||

You can attach the MDF file to the SQL Server 2005 by using the simple command

SP_ATTACH_DB <Give your DB Name, any name is fine>,<Location of the DB file>

and programatically you can connect to the MDF file using code as described in

http://ambarishganguly.blogspot.com/2006/10/sql-server-express-xcopy.html

Hope this helps.

Thanks

Ambarish

sql

No comments:

Post a Comment