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.

Leave a Reply