SQL SERVER – SELECT TOP Shortcut in SQL Server Management Studio (SSMS)

This is tool is pretty old, yet always comes as a handy tip. I had a great trip at TechEd in India. And, during one of my presentations, I was asked if there are any shortcuts to SELECT only TOP 100 records from SSMS.

I immediately told him that if he explores the table in SSMS, he can just right click on it and SELECT TOP 1000 records. If he wanted only 100 records, then he could edit that 1000 to 100 by means of going to Options.

SQL SERVER - SELECT TOP Shortcut in SQL Server Management Studio (SSMS) shortcut1

Go to Options, then hover the mouse over the SQL Server Object Explorer, then proceed to Commands. Afterwards, change the Value for Select Top <n> Audit Records.

After narrating the steps, he told me that he was not looking for the right click option; rather he was asking if there is any kind of keyboard shortcut for convenience’s sake.

Actually, a keyboard shortcut is also possible. SQL Server Management Studio (SSMS) lets you configure the settings you want using a shortcut. Here is how you can do it.

Go to Options, then to Environment. Proceed to Keyboard, and from there, configure your T-SQL with the desired keyword.

SQL SERVER - SELECT TOP Shortcut in SQL Server Management Studio (SSMS) shortcut2

Now, open SSMS New Query Window, and then click and type in any table name.  After that, just hit the shortcut you just made earlier. Doing this should display TOP 100 records in the Result window.

SQL SERVER - SELECT TOP Shortcut in SQL Server Management Studio (SSMS) shortcut3

I am sure this trick is quite old, but it is still helpful to many.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Previous Post
SQL SERVER – What is Spatial Database? – Developing with SQL Server Spatial and Deep Dive into Spatial Indexing
Next Post
SQL SERVER – Find Most Active Database in SQL Server – DMV dm_io_virtual_file_stats

Related Posts

No results found.

31 Comments. Leave new

  • Nice tip.. how woulf with nolock work here?

  • msdotnettechies
    June 6, 2014 6:21 am

    My shortcut keys were overridden. I didn’t do any updates for my Sqlserver and that’s weird. Does anyone have any clue why that happened?

  • Above Shorcut does not work for me

  • Thanks, Pinal. Do you know if we can add TABLESAMPLE as part of this (without having to write a custom stored proc.? e.g SELECT TOP 100 * FROM TABLE_A TABLESAMPLE(20)

    I use this many times to get sample data.

  • Mrinmoy Karanjikar
    December 29, 2017 2:34 pm

    I know this is very old post but if anyone sees, please reply.
    I need shortcut for “SELECT TOP 10 * FROM ” but also need “ORDER BY 1 DESC” in that shortcut. How do I do that?

  • Prafulla kumar Sahu
    May 25, 2018 9:47 am

    This is what I was exactly looking for. Thanks for Sharing

  • It would still be nice to have an autotext option to simply output text, so that I can edit it
    e.g. press CTRL+S make “select * from ” apear in the query editor window

  • My Question is, I have 10000records data in table.in my query i need to split 1000records per each page in site and then if user click “Load More” then load next 1000records to existing and next viceversa..so like that i need to write my query in stored procedure…How can i do in stored procedure?
    As my knowledge we can use OFFSET rows and Top 1000records…how can we slpilt each fileter from end user ?


Leave a Reply