How to: Run a Script on a Database Other than the Current Default

Although each database project in Solution Explorer can have a default database reference, you can run a script on any database.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To run a script on an existing database connection or reference

  1. In Solution Explorer, right-click the script you want to run and choose Run On.

  2. When the Run On dialog box appears, choose a database connection or a database reference from the list, and click OK.

To run a script on a temporary database connection

  1. In Solution Explorer, right-click the script you want to run and choose Run On.

  2. When the Run On dialog box appears, choose the <temporary reference> list item and click OK.

  3. When the Connection dialog box appears, supply the connection information and click OK.

Note

The script runs using the temporary database connection. After the script runs, the connection is deleted.

See Also

Tasks

How to: Connect to a Database from Server Explorer

Other Resources

Working with Scripts