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.
- You can select New Query and this will bring up a new window to type your SQL query.
- 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).
- 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.
- 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.