I’ve created a database in Visual Studio 2008 in an App_Data folder of a MVC Web Application project. This results in an mdf file for the database that can be explored in the Server Explorer tab. You can create a SQL script for changes you do to the database.
So I’m wondering how you run these sql change scripts to an mdf-file in Visual Studio 2008? Or am I forced to do this via the SQL Management Studio Express application?
The syntax is:
This will create a database on the SQL Server you are connected do, creating files with the standard names in the standard location. There are additional options (described on MSDN) that will help you to place the database files elsewhere (including renaming them) if you wish.
To execute this command, you need to connect to SQL server. I recommend SQL Server Management Studio (there’s also the free Express Edition).
Of course, you could also use SQLCMD.