Jan 26 2010

SQL Assistant: Resharper for SQL Management Studio

Category: Uncategorizedzvolkov @ 1:49 pm

SQL Assistant ($149, 14-days free trial) is an extension for SQL Management Studio that adds number of productivity enhancements, sort of like Resharper does for Visual Studio. The most visible features are: much enhanced intellisense complete with column selector (use right arrow to choose multiple columns), and on-the-fly syntax checking (activated after 3 seconds of idle).  SQL Assistant also adds an item to SQL Management Studio menu, with whole bunch of actions you can invoke from there. The most useful for me are:

  • Ctrl+Mouse-hover on table name or procedure to see details. Ctrl+Click for even more details.
  • Ctrl+F11 to reformat SQL code
  • Ctrl+/ to block-comment selected text, Ctrl+\ to uncomment
  • Ctrl+F1 for inline T-SQL syntax helper

Another great feature is Visual Bookmarks. Most code editors have bookmarks activated by keyboard shortcuts which very little people use. With SQL Assistant you can set and navigate bookmarks by clicking on the bookmark column near the scrollbar. This is similar in spirit to setting break points in Visual Studio, but on the right of the editor window.

There’s also bunch of handy and not-so-handy snippets to choose from. These are similar in spirit to Resharper’s live templates. I suggest you actually invest some time to familiarize with them, and fine-tune to actually suit your needs. My favorites out-of-the-boxers are:

  • lj and rj for LEFT JOIN and RIGHT JOIN (I edited mine to remove the word OUTER)
  • The non-invasive Enter-activated ones like begin, while, if, case, begin try, and /*
  • The famous cfetch – just try it!
  • is and iv for INSERT SELECT and INSERT VALUES, complete with all column names
  • I’ve also added ij for INNER JOIN

Now, there are several configuration tricks you need to know if you want to have smooth experience:

1) During installation, it will ask whether you’re SQL Admin vs. Application Developer vs. User. Be sure to choose SQL Admin.

2) Once you installed it, it will run as a tray app. Right click on the tray icon, go to Options.

  • On Targets tab
    • Uncheck everything except MS Management Studio. While SQL Assistant can also integrate with VS.NET, Notepad++ and even Notepad, the integration is kinda suckish so you don’t want that.
    • In MS Management Studio, set the following settings
      • SQL Reference = MSSQL T-SQL 2008
      • Options\Jump to matching bracket = No
      • Options\List Item Selection Key = Enter, Tab
  • On DB Options tab
    • Under SQL Server, set Show Keys and Indexed Columns to Yes
  • On Code Snippets tab
    • Under T-SQL Snippets, set Default Key Char to Space

If you’re as annoyed as I am by the way native Intellisense works in SQL Management Studio, you should be releived. Go and try SQL Assistant, I think you will like it.

UPDATE: another similar product is Sql Prompt, by Red Gate. I’ve just installed the trial on my system and will share my experiences in a few weeks.