February 17, 2013 2 Comments
Throughout my career I have worked with different programming and database tools. Thinking back the tools that I enjoyed using were the tools that were easy to get the job done, and the tools that I hated using were the tools that were the most difficult to use. Being good at what I do means mastering the tools so that I can be more productive with my time.
Yesterday at SQL Saturday 198 in Vancouver I learned lots of great things with SQL Server, but there were a couple small things that I picked up on to improve my overall performance when working in SQL Server Management Studio (SSMS).
I thought it might be fun to create a list of the thing that I normally do, along with a few new things that I learned just yesterday at SQL Saturday.
1. Display results in a separate tab.
This has been my favorite for a couple of years now. Here is how you set it up.
Open SSMS, and from the top “Tools” menu choose “Options…”.
From the options dialog navigate through the heirarchy to the Query Results, SQL Server, Results to Grid page as shown here.
You will need to check the “Display results in a spererate tab” checkbox, and I suggest that you also check the “Switch to results tab after the query executes”.
You will need to open a new query windows to see this change. Once it runs you will end up with the results grid taking the entire query window area, and a new tab up top to switch back to your query. This saves time when viewing results because you need to do less scrolling to see your results. This is also impacts the execution plan window. Give it a try it will look something like this.
Once you have this configured, there will be no need to battle with that split screen results again.
2. Hotkey for SELECT TOP 100 * FROM …
Just learned this one yesterday at SQL Saturday. Quite often when working in a database, I need to take a look at what some of the data looks like in a table, so I find myself opening a new query window and typing SELECT TOP 100 * FROM Table name. I find myself doing this all the time. Yesterday I learned a new trick, and that is to set up a keyboard shortcut that allows you to highlighta table name anywhere in a query window, then just hit a shortcut key, in my case CTRL+3, and it runs the SELECT TOP 100 * FROM … query for the table name that is highlighted.
Here is how you do it. From the options dialog navigate through the heirarchy to the Environment, Keyboard, Query Shortcuts page.
Here, choose the shortcut key you want to map, and enter “SELECT TOP 100 * FROM ” into the Stored Procedure column. Yes, I know its not a stored procedure, but just give it a try.
Then hit OK on the dialog. You may need to restart SSMS for this to work.
After restarting, then just highlight a table name in any query editing window and hit the short combination, CTRL + 3 in this example. This will save me lots of time.
3. sp_help by using Alt+F1
Another big time saver, just highlight the name of a table, then hit Alt+F1, and sp_help will be run against that table name.
Thats my time saving for today. 3 steps to make your SSMS experience more productive.