T-SQL Tuesday #025 Tips and Tricks

by Greg M Lucas on 13 December 2011

TSQL Tuesday 08-Nov-2011

This month’s T-SQL Tuesday is hosted by Allen White (blog | twitter) with a theme of Tips and Tricks.  Choosing what to write about is not as simple as one might think (at least for me), we all have little tricks up our sleeves but the question is which of these would be useful to someone else. Things I take for granted might be a revelation to someone else but I may have been using them for so long that I’ve forgotten what a revelation they were when I first discovered them.  Personally, I make a lot of use of various keyboard short cuts so I thought I would have a little fun with the T-SQL Tuesday theme and share a few of  the shortcuts I use every day.

T CTRL + ALT + T Show template explorer
- Anyone know a cool hyphen shortcut?
S CTRL + S Save the currently selected file
Q CTRL + SHIFT + Q Show the graphical query designer
L CTRL + SHIFT + L Make selection lower case (also CTRL + SHIFT + U to upper)
     
T CTRL + T Results to Text
u CTRL + U Change database. UP/DOWN to select database then ENTER
e CTRL + E Run the current selected command(s)
s CTRL + SHIFT + S Save all files
d CTRL + D Results to Grid
a CTRL + A Select All (Sorry, couldn’t think of a better one for A)
y CTRL + Y Redo previously undone edit (also CTRL + Z for Undo)
     
     

And for good measure, here are a few more useful shortcuts that didn’t quite fit into my chosen theme…

  • CTRL + SHIFT + M – specify values for template parameters
  • ALT + BREAK – Cancel the executing query
  • CTRL + R – hides or displays of results window (when not in tabbed mode)
  • F6 to toggle between tabs if you have results in separate tabs
  • F CTRL + SHIFT + F – Results to file
  • CTRL + F5 – Parse selected commands
  • CTRL + G – GoTo (line number)
  • CTRL + K then C – comment selection
  • CTRL + K then U – uncomment selection
  • CTRL + F – Find
  • CTRL + H – Replace
  • CTRL + L – Display estimated execution plan
  • CTRL + M – Include actual execution plan
  • CTRL + N – New query with current connection
  • CTRL + 0 – Open File
  • F8 – View Object Explorer
  • F7 – View object explorer details
  • CTRL + ALT + G – View Registered Servers
  • CTRL + ALT + L – View Solution Explorer
  • CTRL + ALT + T – View Template Explorer

If you want a complete listing, the most comprehensive I’ve found is on SimpleTalk and if you want to add your own custom shortcuts, Lee Everest has a really useful post on just that.

One final tip. If you’re a regular reader of this blog, you’ll know that TDD for T-SQL, and tSQLt especially is a bit of a thing of mine, so, if you’ve installed the GUI Test Runner available free from RedGate, the SHIFT + ALT + Z is the shortcut you need to re-open the SQL Test window.

I hope you’ve discovered, or re-discovered at least one useful tip.

Comments on this entry are closed.

{ 1 trackback }

Previous post:

Next post: