3

I created a "Service-Based Database" (.MDF) in Visual Studio and now want to import a SQL script into it, but cannot find any way to do this:

  • I can right-click on the .mdf file and choose "New Query" but there is no place to copy in query text as in Management Studio

Does the Visual Studio 2008 Database Explorer have a way to enter or import SQL query text?

2
  • 1
    Do you want to execute the SQL in the file against the MDF? Commented Nov 13, 2009 at 18:00
  • I also wish to solve this problem & yes I do want to execute the sql in the file against the MDF Commented Apr 28, 2010 at 1:06

2 Answers 2

2

When you choose "New Query", the default behavior is to open the Query Editor. So you have to close the Add Table. After that, you should see a window with four panes - Diagram, Criteria, SQL and Result pane. You should be able to put your script to SQL pane and run from it. The Studio may complain about being unable to parse the script, just ignore it and hit ok, the script should run.

If you cannot see these panes, ensure you have "Query Designer" toolbar enabled and "SQL pane" button pushed.

However, I would recommend installing SQL Management Studio, there is a free express version available.

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

1 Comment

Thanks Mate, We can ignore visual studio paring error. It works :) Thanks a ton.
0

Why don't you just attach the database directly to your SQL Server (or SQLExpress) and then copy the database objects. The detach from the sql server again.

Comments

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.