Running sql scripts against an attached database?

Posted by Will on Stack Overflow See other posts from Stack Overflow or by Will
Published on 2010-01-16T22:01:53Z Indexed on 2010/04/16 23:03 UTC
Read the original article Hit count: 158

Filed under:
|
|
|

I've got an MDF attached to an instance of Sql Server 2008 Express, and I need to run some sql scripts against it to generate tables, indexes, etc.

But I can't figure out how to get this to work. If I load the scripts in Visual Studio, it only allows me to connect to the server and run it against a database. I can't choose a different provider (Microsoft Sql Server Database File), so I can't select my MDF.

This leaves me the only option of running the script as individual queries, but that won't work as it appears it doesn't support TSQL CREATE statements.

How can I run my sql script against an attached database?

© Stack Overflow or respective owner

Related posts about mdf

Related posts about sql-server-express