You can open many different query windows in SQL Server Management Studio (SSMS). Each query window creates its own connection to the specified database. Even though SQL Server supports executing multiple queries over the same connect, no connections are shared in SSMS.
Here’s a cool thing you can do from a query window. Press F4, or select Properies Window from the View menu. When you open the properties you can see a number of data points that are tracked for each database connection, or to be more complete, all the properties of a specific query window.
To name a few of the properties there are statistics for how long you have been connected, what are the results of your latest query execution regarding execution time and row counts, what sql instance the query was connected to, what database the query was connected to, and much more.
In the query window you can see some of this information. If you set statistics on when you run the query, you can see some additional information in your query output, showing up in the messages tab for your query results. For more details such as the credentials used to connect to the database server, open a properties window from a query window and you’ll see lots of interesting information about your query.
Since I’m talking about being in a query window, here are two hot tips.
Have you ever been frustrated when you have a query window open with TSQL text calling a stored procedure, your press F5 to run the query, and it tries to open the stored procedure in Debug mode? That is the default if you press F5 in many configurations. If you want to run the Execute without debug, press Ctrl-E, and your query will always execute rather than trying to execute in Debug.
Ctrl-R is a great key combination after you’re query has completed execution. When you query completes by default it shows another window with on to three tabs. The query results (if you are returning the results to a grid), a query plan (if you have show plan turned on), and messages. When you press Ctrl-R after the query completes, the results window will hide. Press Ctrl-R again and the results window appears, in a toggling manner.