Creating a remote database from a script

Learning Resources
 

Creating a remote database from a script


When using Visual Studio to create your web projects, you may choose to use the ASP.NET Configuration tool to create your users and roles. This will create a set of tables which are then placed in a local ASPNETDB.MDF SQL Server express database. (These same steps may be used to copy any MDF database to your remote SQL Server database.)

From Visual Studio, in your Server Explorer tab, you'll notice all of the tables created by default. As well, there are Views, Stored Procedures, etc.

First, we want to create a SQL script to recreate all of those objects. So right click the database and select Publish To Provider. This will bring up the Database Publishing Wizard. Select the button to continue.

You will be presented with a list of your databases and asked to select your database. There is a checkbox to Script all objects in the database. Select it. Select Next to continue.

Now you are given the option to script to a file. It presents a default path. change as per need.

In the next window you will be offered several options. Select the target you need, then Select to continue.

Next you may review the options selected.

Click Finish to complete the Wizard.

Now you have a fancy script generated for you. This script will select, alter, drop, update, insert, etc. etc., all needed values.

 

 For Support