SQL SERVER – Query Analyzer Shortcuts

Download Query Analyzer Shortcuts (PDF)

Shortcut Function Shortcut Function
ALT+BREAK Cancel a query CTRL+SHIFT+F2 Clear all bookmarks
ALT+F1 Database object information CTRL+SHIFT+INSERT Insert a template
ALT+F4 Exit CTRL+SHIFT+L Make selection lowercase
CTRL+A Select all CTRL+SHIFT+M Replace template parameters
CTRL+B Move the splitter CTRL+SHIFT+P Open
CTRL+C Copy CTRL+SHIFT+R Remove comment
CTRL+D Display results in grid format CTRL+SHIFT+S Show client statistics
CTRL+Delete Delete through the end of the line CTRL+SHIFT+T Show server trace
CTRL+E Execute query CTRL+SHIFT+U Make selection uppercase
CTRL+F Find CTRL+T Display results in text format
CTRL+F2 Insert/remove bookmark CTRL+U Change database
CTRL+F4 Disconnect CTRL+V Paste
CTRL+F5 Parse query and check syntax CTRL+W Window selector
CTRL+G Go to line CTRL+X Delete
CTRL+H Replace CTRL+Z Undo
CTRL+I Index Tuning Wizard F1 Help for Query Analyzer
CTRL+K Display/hide execution plan F2 Move to next bookmark
CTRL+L Display execution plan F3 Repeat last search
CTRL+N New query window F4 Object Search
CTRL+O Connect F5 Execute a query
CTRL+P Print F6 Switch between query and result panes
CTRL+R Show/Hide results pane F8 Show/hide Object Browser
CTRL+S Save SHIFT+F1 Transact-SQL help
CTRL+SHIFT+0 Show options SHIFT+F2 Move to previous bookmark
CTRL+SHIFT+C Comment out code SHIFT+TAB Decrease indent
CTRL+SHIFT+DEL Clear the active Editor pane SHIFT+F6 Switch panes
CTRL+SHIFT+F Save results to file TAB Increase indent

Download the PDF

Reference: Pinal Dave (http://blog.SQLAuthority.com), MSDN

39 thoughts on “SQL SERVER – Query Analyzer Shortcuts

  1. Pingback: Download SQL Server Management Studio Keyboard Shortcuts (SSMS Shortcuts) Journey to SQL Authority with Pinal Dave

  2. Hi,

    I have used ALT + F1 and its really good habit to use it while working.

    I have one query here with table with schema,

    I have table named [Product].[DetailTable] where product is my schema instead of dbo

    I can execute this query
    SELECT * FROM [Product].[DetailTable]

    but when I go to use ALT + F1

    it gives error like – “Incorrect syntax near ‘.’.”

    Any idea?

    Like

  3. one more thing, I can execute sp_helptext with any object ow dbo but

    if i go for sp_helptext Product.DetailTable

    It will give same error.

    Thanks

    Viral

    Like

  4. sqlwb is not a shortcut for Query Analyzer in SQL Server 2005. It opens the Management Studio which in my view is far slower than Query Analyzer in editing and manipulating queries.
    Why they chose to remove a quick solid working program I cannot understand.
    How do you even format your queries in Management Studio?
    For me it does not accept tabs and will reformat as soon as I execute.

    Like

  5. Hi Robert,

    MSSQL server 2005 is a database platform , Platform because from one window you can connect to any of MSSQL services like SSMS, SSRS,SSIS,SSAS..etc.

    I am coming to your doubt why they shifted to SSMS as it s far slow.

    As the matter of fact MSSQL 2005 is more graphical more user friendly and handy tool, I hope once you will aware of all SSMS functionality or new feature you might change your views, I agree it require more hardware recourses like RAM, 500 MB Min, and 1000 Mb Recommended rest depends on your work load. Also I feel you would be more contented with 2000 but still there are new upcoming DBA’s which require these sort of user friendly interface.(If still you face slowness check your settings and resourses.)

    Shortcut Doubts:

    2000 – isqlw –To open a query analyzer in 2000

    2005 – sqlwb—To open SSMS in 2005 (Not Query analyzer For New Query use Alt+N)

    2005 –ssmsee—TO open SSMS in 2005 (Express Edition)

    Rest of the short cuts you can check as Pinal already discussed in the top of the blog.

    Thanks

    Praveen Barath

    P:S:
    SSMS- Sql server management studio

    Like

  6. The most commonly used keyboard shortcuts in the SQL Server Management Studio (SSMS).

    Run and then SqlWb.exe to launch SQL Server Management Studio

    Results in Grid
    Ctrl + D

    Change database
    Ctrl + U

    Results in Text
    Ctrl + T

    Execute Query
    Ctrl + E or F5

    Show/Hide Object browser
    F8 (Auto Hide has to be enabled)

    New Query Window
    Ctrl + Q

    New Query with New Connection
    Ctrl + N (Then selecting SQL Server Query template)

    Open a .SQL Script file
    Ctrl + O

    Full Screen
    Shift + Alt + Enter

    Parse the query
    Ctrl + F5

    Show/Hide Results Pane
    Ctrl + R

    Switch between query and results panes
    F6

    Information about all the objects in the current database
    Alt + F1

    Praveen Barath

    Like

  7. Pingback: SQL SERVER - Query Analyzer Shortcuts - Part 2 Journey to SQL Authority with Pinal Dave

  8. I was creating a table name ContactForm and then i inserted values in the table but its gives an error—— please see the details—————-

    CREATE TABLE [dbo].[ContactForm] (
    [Cust_Id] [int] PRIMARY KEY NOT NULL,
    [Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Address] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [City] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [State] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Country] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Contact_No] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [E_mail] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Company] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Job_Title] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Relation] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Abt_us] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Msg] [varchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    ) ON [PRIMARY]

    Values insertion:
    Insert into ContactForm Values (1, ‘Saurabh Verma’,’18/271, Behron Gali, Maithan’, ‘Agra’,
    ‘Uttar Pradesh’, ‘India’, 09319394568, ‘iamsaurabhverma@gmail.com’, ‘Image Software’,
    ‘Web Developer & Designer’, ‘Employee’, ‘Events’, ‘Please Reply’)

    Error:
    Msg 8152, Level 16, State 14, Line 1
    String or binary data would be truncated.
    The statement has been terminated.

    Please give me suggestions

    Like

  9. @Name

    in Your table 10th column which is job_title is defined to take not more than 20 characters, but in your insert statement you are trying to insert 24 characters which is “Web Developer & Designer”. That is why insert statement is failing.

    Solution for this problem is either change the max size of the job_title column to 50 or make the value of that column small example : “Web Devp & Designer.”

    Hope this helps.

    Thanks,
    Imran.

    Like

  10. Dear All,

    please help me out for restoring the database for sql 2000, i m getting error ” database is already in use” when i try to do the restore.

    please help me to get the command to stop the database.

    Thanks

    Rehan

    Like

  11. Hi Rehan,

    Can you recheck whether the database existed with same (the db name which you want restore). if not found in Enterprise Manager, Enter the command as Use DBNAME in Query Analyzer.

    If found in Enterprise Manager, check query analyzer opened with the that Data base. close the query analyzer and delete the exist data base.

    If still also not able to delete, clear the connections in detach window and delete the .mdf & log files in the specified path.

    Hope it will solve.

    Thanks
    BJN

    Like

  12. I have been using SQL Server 2000 for several years and I have used DTS to import and export data between internal and external tables.

    Recently I installed SQL Server 2005 “Developer” and can not find DTS.

    Any suggestions? Thanks

    Like

  13. Hi ,what does ‘N’ and ‘U’ in the following command stand for?also what is the necessity of Go in this ??? the following command executed even without the use of it?..

    USE AdventureWorks;
    GO
    IF OBJECT_ID (N’dbo.AWBuildVersion’, N’U’) IS NOT NULL
    DROP TABLE dbo.AWBuildVersion;
    GO

    Like

  14. hi im trying to open mssms and load a store procedure from an specific data base using this script
    sqlwb.exe [-S server_name[\instance]] [-d dbname] [-U dbuser] [-P dbpass] [-E] [file_name[, sp_search]] [/?]

    but is not working to load the sp but the mssms it does open

    any sugestion?

    Like

  15. What about CTRL-0 for entering a NULL value into a field when looking at grid view of a table.

    Also, is there a CTRL-? shortcut for entering the current date and time into a datetime field similar to the CTRL-0 shortcut for the NULL value?

    Like

  16. is there anyway to disable the keyboard shortcut ctrl+e for Execute?

    it is so close to ctrl+r , ctrl+d etc.. accidentally pressing it when working on a query could be disastrous..

    Like

  17. Hi,

    Is there any short cut to write “Select * from” in SQL 2005 or 2008. If such a short cut exists please let me know.

    thanks and regards,
    Arvind Dhiman

    Like

  18. hello sir

    i have one database .i have two tabie (emp), (salary). i have 300 rows in emp table.but i have no rows in salary
    i have merge that two tables emp and salary
    select * into salary from emp , i have added 100 rows in emp
    i want a that second time i merge that two table emp or
    salary only for 1oo rows not 300 rows
    thankyou
    pinal dave sir

    Like

  19. when am writing a procedure or function in a query analyser sql server 2008 am not getting a intelligence popup which will guide to select the function,object or column or table names.
    Do i have to install a specific service pack ??Please suggest me.

    Like

  20. Pingback: SQL SERVER – Weekly Series – Memory Lane – #013 « SQL Server Journey with SQL Authority

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s