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.
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.
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.
I am sure this trick is quite old, but it is still helpful to many.
Reference: Pinal Dave (https://blog.sqlauthority.com)
31 Comments. Leave new
Nice tip.. how woulf with nolock work here?
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.
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?
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 ?