1

I am trying to export my database on sql server 2008 as a SQL server primary data file so that I can drag and drop it within my ASP.NET application APP_Data Folder, rather than refering the web app to the database datasource in sql server 2008. This might generate a problem in accessing the database when the web app is hosted. Is there a way to export it as .mdf file with its logs, drag and drop it to my web app ?

Regards.

2 Answers 2

1

M. Shbib, I think what Mr. Lewis means is "have you tried detaching the database in SQL Server, then copying the .mdf and .ldf files from the SQL Server Data folder to your App_Data folder?"

You can find where your files are by right-clicking your database in SQL Server and selecting Properties. The path is listed in the File section, but you may have to scroll right to find it. It should be something like c:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLSERVEREXPRESS\MSSQL\DATA (depending on your version of SQL Server). You will need to detach the database in SQL Server before you are allowed to copy it, otherwise you'll get an error that it is in use. Once you've detached it, navigate to the Data folder, copy both the mdf and ldf files and paste them into your App_Data folder.

Sign up to request clarification or add additional context in comments.

Comments

1

Have you tried detaching the database on the SQL server, then copying the file to your App_Data folder?

1 Comment

even if I detach it, sql server only removes it from the databases list and that is it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.