Countless developers are using SQL Server Management Studio (SSMS) to develop & design databases at work. Without any benefit of the doubt – SSMS IDE bundles with several amazing features and tools for developers. Alas, few of us really know valuable features and hidden tips and tricks within SSMS. Definitely, learning these SSMS productivity tips and tricks can save time and help to work more skilfully.
In this tech-recipe post and SSMS productivity trips & tricks series, we shall explore essential stuff to make our daily programming life more easy and intuitive.
In this first part, the following tips & tricks are covered.
1. Drag column names to query window
2. Object explorer details
3. Use Vertical Map scroll mode
4. Shortcut to SQL Server BookOnline
5. Multiple Batch Execution – Go Statement
Let us go in detail and understand the listed tips & tricks in detail.
Drag Column Names to Query Window
Frequently, we need to write a few or all the column names for a particular table instead of writing SELECT *. Although IntelliSense can greatly help to do this. However, if your table has many columns then it is a tedious task.
Assuming you have written a SELECT statement and now want to have all the column names for a particular table. Navigate to the table name in the object explorer, expand columns, drag & drop columns to the query window, and you are done.
Object Explorer Details
Even though we have an object explorer to navigate to database objects. However, it lacks showing other metadata information. Open Object Explorer Details, navigate to View > Object Explorer Details or keyboard shortcut (Press – F7).
Useful features within object explorer details.
1. Search for a particular object within the entire database.
2. Add more columns like row count, data space used, created date, and many more.
3. Sorting & filtering.
4. Details pane with object metadata.
Use Vertical Map Scroll Mode
Feeling frustrated while debugging and navigating through long lines of stored procedures & views is a common feeling across developers. Alas, we have Map mode to our rescue. Using map mode gives a sneak peek at the entire code to quickly scroll and jump to a particular location. I use this all the time.
Shortcut to SQL Server BookOnline
You need quick help from official Microsoft documentation on any of the functions, clauses, and code. You can just select the word and press F1. This will redirect you to Microsoft Books online help to provide more details to understand. I use this feature mostly as I keep discovering new functions within code.
In the following figure, I selected ANSI_NULLS in the query window and pressed F1. This redirected me to official documentation with all the information I need to understand it in detail.
Multiple Batch Execution – GO Statement
GO statement is known for batch termination but I have recently discovered one more hidden gem. Using GO statement to execute a batch multiple times. If you have an INSERT statement to populate random data and need to execute it 10 times. Simply write GO 10 after that statement.
In the following illustration, I am inserting random numbers between 1 to 100 with GO 10 batch termination. It populated 10 rows in the target table.
In a nutshell, we have learned various productivity tips & tricks using SSMS. We will continue with series of articles to share more stuff. If you like this post you may reach through Tech-Recipes database archive to learn more stuff.
Read more and browse through more posts related to SQL Server on Tech-Recipes.
1. 11 Keyboard Shortcuts Every SQL Server Geek Should Know
2. How To Create Custom Keyboard Shortcut In SQL Server
3. How To Refresh Intellisense Cache In SQL Server
4. How To Enable Dark Theme In SQL Server
5. How To Index Computed Column In SQL Server
6. How To Use Computed Column In SQL Server
7. Execute SQL Files Using SQLCMD