When looking at long queries you’ll typically need to remember what data is in one of the tables. SSMS allows the creation of shortcut keys that can be used to quickly look at the first row in a table. You’ll then be able to see the column names and some example data.
In SQL Server Management Studio (2012 shown), create a new shortcut key by going to:
Tools > Options > Environment > Keyboard > Query Shortcuts
Add the beginning of a query to the shortcut key you like, later on you’ll see how the table name will be appended when the query is run.
“SELECT TOP 1 * FROM”
After you click ok on the dialog, and create a new query window, you’ll be able to select a table name in a query and use your shortcut key. The selection in the query analyzer will be appended to your shortcut query and run.
The screenshots are from SQL Server Management Studio 2012, but older versions have the shortcut key option too. I bet it even works in the old Query Analyzer.
Cool eh? Maybe you like to get the top 200 rows to get a better picture of the table’s data? I’m sure you’ll have tons of ideas on cool shortcuts you can run. Be nice and leave me some ideas in the comments.