Query Editor is one of Microsoft's core SQL Server 2005 management tools. It's an entirely new tool, not just an upgrade of the Query Analyzer tool in earlier SQL Server versions. It uses many familiar Query Analyzer keyboard shortcuts, but you'll find new ones as well. I've gathered 10 of my favorites here.
10. Run the Statement: F5
I use the F5 shortcut key the most. You can use F5 to run selected text or all of the statements in the Query Editor window—much handier than clicking Execute.
9. Cancel the Currently Executing Query: ALT+BREAKIf a query is taking an unexpectedly long time to execute, you can hit ALT+BREAK to cancel the query execution, returning control to the Query Editor editing window.
8. Copy, Cut, Paste, Undo, Redo: CTRL+C, CTRL+X, CTRL+V, CTRL+Z, CTRL+YQuery Editor conveniently uses standard Microsoft editing keyboard shortcuts.
Jump to the Next Word: CRTL+ARROWAnother handy keyboard shortcut, CTRL+ARROW lets you rapidly move through the contents of the QE editing window one word at a time. Skip to the right with CTRL+RIGHT ARROW; skip to the left with CTRL+LEFT ARROW.
6. Comment the Selected Line: CTRL+CWhile I'm developing code or testing statements in Query Editor, I use CTRL+C to comment the line in the Query Editor editing window. You can uncomment the line by using CTRL+U.
5. Convert to Uppercase: CRTL+SHIFT+UBefore I save the final copies of stored procedures or T-SQL batches, I ensure they follow the coding convention of using all caps for T-SQL keywords by selecting the text and pressing CRTL+SHIFT+U. To convert to lower case, press CTRL+SHIFT+L.
4. Display the Go To Line Dialog Box: CTRL+GWhen you're working with large stored procedures, CTRL+G displays the Go To line dialog box, which lets you enter a line number and click OK to jump directly to the specified line.