Skip navigation

Query Analyzer Shortcuts

Query Analyzer is one of the most frequently used utilities in SQL Server's tool set. As every DBA knows, Query Analyzer is essentially SQL Server's command console. Query Analyzer's GUI makes it easy to use. In fact, you can easily overlook the fact that Query Analyzer doesn't just provide a GUI-style point-and-click interface—it also provides full support for a set of keyboard shortcuts that make Query Analyzer a more effective and productive tool. Taking advantage of these shortcuts lets you quickly enter and execute SQL statements without needing to take your hands off the keyboard to use the mouse. Here are seven keyboard shortcuts that can help you be more productive when you're using Query Analyzer.

7. F5


The F5 key is the keyboard shortcut that I use most frequently. Pressing the F5 key runs the current query and lets you avoid taking your hands off the keyboard to click the green run icon.

6. F8


You can use the F8 key to quickly toggle the display of the Object Browser window in the left side of the Query Analyzer window. If the Object Browser window is displayed, pressing F8 closes it. If the Object Browser is closed, pressing the F8 key displays it.

5. F4


Pressing the F4 key displays Query Analyzer's Object Search dialog box. Object Search lets you search for a table name, view, stored procedure, user-defined function (UDF), column, index trigger, extended stored procedure, or constraint in one database or in all the databases on the server. You can set up more than one search criterion by pressing F4 multiple times.

4. Alt+F1


The Alt+F1 keyboard shortcut is a quick way to run the sp_help stored procedure. If nothing is selected in the Query Analyzer window, Alt+F1 runs sp_help for the current database. If the name of a database object is selected, sp_help runs for the selected database object.

3. Ctrl+1


Another handy keyboard shortcut, Ctrl+1, runs the sp_who stored procedure. If a SQL Server login name is selected in the Query Analyzer window, sp_who runs for the selected database object. If no name is selected, Ctrl+1 runs sp_who for the database you're currently in.

2. Ctrl+2


The Ctrl+2 keyboard shortcut executes the sp_lock stored procedure for the current database. This keyboard shortcut doesn't let you use parameters.

1. Your Own Shortcuts


The best keyboard shortcuts are always your own, and Query Analyzer lets you add as many as nine of them. From the Tools menu, select Customize, then select the Custom tab. You can choose a keyboard combination and enter the name of a stored procedure that you want to run when you press that keyboard combination.

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish