SQL SERVER – SELECT TOP Shortcut in SQL Server Management Studio (SSMS)
- by pinaldave
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 (http://blog.SQLAuthority.com)
Filed under: Pinal Dave, SQL, SQL Add-On, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology