SQL Server Management Studio (or SSMS) has a lot of depth to it that most of us are probably not even aware of. Typically we get into a habit of doing things on the basis of what we know. Also, I believe that as a DBA my primary concern is the databases and making sure my scripts are correct, and I’m sure I’m not alone here.
Lately I’ve tried to push myself in getting to grips with the IDE and making better use of the built in functionality. In a seriously lose tie in with Friday 13th, here’s 13 tips for using SQL Studio Management Studio. Some of them are very basic, and some of them are quite obscure.
1. Pressing Ctrl + R when you have the results window open in SSMS will auto-hide it.
To bring it back press Ctrl + R again.
2. If you accidentally hit CTRL + SHIFT + R then this may be a good thing: This will clear the cache of the Intellisense.
You can do this through the UI by going to Edit > Intellisense > Refresh Local Cache.
5. If you want to manually prompt for Intellisense then press ALT+RIGHT ARROW or CTRL+SPACE.
6. Intellisense will not work in SQLCMD mode. Check that it is enabled under Query > If you cannot see Query as a menu option click on a Query window
The sqlcmd utility is a command-line utility for ad hoc, interactive execution of Transact-SQL statements and scripts and for automating Transact-SQL scripting tasks. Though it is cmd line it can be run through the UI. If that sounds crazy then sure maybe, but it’s a lot easier than running large scripts through the UI than it is the cmd line.
7. You can enable running all new query windows in SQLCMD by going to Tools > Options > Query Execution and selecting “by default, open new queries in SQLCMD mode”.
8. If you have a block of T-SQL you want to comment out, highlight it then click CTRL K, CTRL C.
10. If you need to add some characters to the beginning or the end of a long list in SSMS, you can do so by moving the cursor to where you want to start, then press and hold down a mouse button click, then press and hold down alt, then drag the cursor down the line until you reach the end. You will see a faint grey line. Then you can press whatever character you need to enter and it will appear at the beginning of the line.
At first you may see an error message like below.
12. to enable or disable the line numbers in SSMS, click Tools > Options, expand the Text Editor option, expand All Languages and select General
13. If you need to go to a particular line number press CTRL + G to open the Go To Line window; enter the line number and click OK:
Do you have any tips and tricks with SSMS? It’d be great for you to share them here.