Partager via


How to: Run SQL Scripts in Solution Explorer

You can run SQL scripts in Solution Explorer by dragging a script file to a database in the Database References folder. Another way to run SQL scripts is right-clicking the script and choosing either Run or Run On from the shortcut menu. When you choose Run, the SQL script runs on the default database. When you choose Run On, you can select which database to use.

Note   For a list of the SQL script file extensions you can use, see Working with Scripts.

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 Customizing Development Settings in Visual Studio.

To run an SQL script in Solution Explorer

  1. In Solution Explorer, drag an SQL script to a database reference. This could be a change, create, or query SQL script.

    The Execute Scripts or Queries dialog box appears.

  2. Click Yes to proceed with the script, or click No to avoid running the script.

See Also

Reference

Run On Dialog Box

Concepts

Database Connections and Database References

Other Resources

Working with Scripts

Working with Scripts