Introduction

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.

beforectrlplusr_png

afterctrlplusr_png

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.

intellsneserefreshui_png

checkintellisenseenabled_png

intellisensesettings_png

5. If you want to manually prompt for Intellisense then press ALT+RIGHT ARROW or CTRL+SPACE.

promptintellisense_png

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

sqlcmd_png

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”.

2013-09-04 16_00_19-MDXQuery1.mdx - (local)_refresh.Analysis Services Tutorial (CORP_richard
8. If you have a block of T-SQL you want to comment out, highlight it then click CTRL K, CTRL C.

commented_png If you want to uncomment it, then press CTRL K, CTRL U.

uncommented_png

commentuncommentui_png

sqleditortoolbar_png

clickalthold_png

clickalthold2_png

```sql select 1; [/code]

At first you may see an error message like below.

transport-level-error_png

12. to enable or disable the line numbers in SSMS, click Tools > Options, expand the Text Editor option, expand All Languages and select General

linenumbersoptions1_png

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:

gotoline_png

Do you have any tips and tricks with SSMS? It’d be great for you to share them here.