Share 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

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

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

Concepts

Database Connections and Database References

Reference

Run On Dialog Box

Other Resources

Working with Scripts

Working with Scripts