Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8234293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:25:32+00:00 2026-06-07T18:25:32+00:00

I have the following setup: Development: My own computer using an MDF file with

  • 0

I have the following setup:

  • Development: My own computer using an MDF file with a connectionstring which refers to my app_data folder.
  • Production: An online server with its own SQL database

When I want to create a new table / fields in my system, I create it in deployment and then run those scripts on production without data.

Now, I am in the opposite situation: I’ve generated scripts from my production server, and wants to run those towards my local MDF file.

How do I do that? All the answers i’ve seen so far doesn’t help me.

I’ve tried the following:

I’ve tried to run the whole SQL script in the “Run query” in Visual Studio, but I get a “The Set SQL construct or statement is not supported.” error.

I guess I have to open the MDF file somehow in Microsoft SQL Management Studio – but I can’t really find a way to get it all to work.

EDIT:

After half a year, I’ve been using the method suggested as the answer again and again. It is by far the best solution. No more MDF files in the project!

I would strongly suggest anyone reading this to start having your databases in your local database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:25:33+00:00Added an answer on June 7, 2026 at 6:25 pm

    In my opinion, the whole AttachDbFileName= approach is flawed. Since that .mdf file is not attached to your SQL Server instance that’s already installed, there’s many things you cannot do:

    • you cannot use BACKUP to back up your database
    • you cannot easily execute .sql scripts against your database
    • and quite a few more things

    The only really viable solution in my opinion would be to

    1. install SQL Server Express (and you’ve already done that anyway)
    2. install SQL Server Management Studio Express
    3. create your database in SSMS Express, give it a logical name (e.g. YourDatabase)
    4. connect to it using its logical database name (given when you create it on the server) – and don’t mess around with physical database files and user instances. In that case, your connection string would be something like:

      Data Source=.\\SQLEXPRESS;Database=YourDatabase;Integrated Security=True
      

      and everything else is exactly the same as before…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following setup. The folder itext is in the top level in
I am using Subversion since quite some time for Java-Development and I have setup
I have the following setup for my daily/main/only development environment Hardware/Tin = 4gb ram,
Say we have the following development setup: Team 1 in location A with a
I have the following Setup: One service called CoreHost should receive a ExecuteWorkflowByAttributeCommand which
In development mode, I have the following directory tree : | my_project/ | setup.py
I have the following code setup for my admin_add in my photocategories_controller.php file. This
I have recently setup a new development PC, which is 64 bit and has
I have following setup, but when I put 1024 and replace all 512 with
I have following models setup in my Django application class School(models.Model): name = models.TextField()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.