Understanding the SQL Query Window

Knowing where to look to run a query is also extremely helpful to getting started.  There are three locations within SQL Server that you need to be aware of to get started.

Post 20.1.png

  1. You can select New Query and this will bring up a new window to type your SQL query.
  2. You will see a box appear under the new query with the name of one of the databases. Whatever is in this box is the database that the query will run against (except if specifies otherwise in your query).
  3. The third box is the name of the databases. If you right click on your database that you want to pull information from and select New Query.

Tips:

  • You can highlight part of a query and it will not run the entire script, only what is highlighted.
  • You can select F5 or the execute button in box 2 to run the query.
  • Adding – before a query will make it not able to run. This is useful if you have a select statement and a delete statement in same query window and don’t want the delete statement to run yet.

 

 


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *