Monday, November 28, 2011

Tips for SSMS to improve quality of work

PROBLEM:
You want some tips to improve your quality of work with SQL Server Management Studio

SOLUTION:
Create your own shortcuts - The next option is part of the inherent capabilities of SSMS. Familiar with the sp_who? Know that you can run it using Ctrl +1? How to do it? Go to Tools-> Options
Then access to the Keyboard:
Advanced shortcuts - If you write 67 in the query window, mark the number and then press Ctrl +1, the SSMS will run the sp_who with value 67 (or in other words - will give you all the details on the SPID 67). This way you can use the shortcuts to perform more tricks. For example, note the shortcut of Ctrl +4 for me:
Shortcut to run the text: "SELECT TOP 100 * FROM" (Important - with space at the end). I suppose that at least some of you occasionally run this query. So all you need to do is register the name of the table from which you want to pull the window, then select it and press Ctrl +4

List columns in a table - It possible to drag objects from the Object Explorer into the query window and get their name, I guess everyone knows. But what if you want to list a specific table column? For insert, you can of course use the script as insert on the table. But for other uses, if you want just the list of columns, you can do the trick: Put the cursor on the word "Columns", and drag it to the window. The SSMS will give you the list of columns with commas between them:

SSMS ToolsPack - The ultimate extension called SSMSToolsPack. The plug has a lot of options, one of which is more shortcuts capabilities. You can choose a small number of letters of code, you type them with Enter at the end - and a snippet of code you want appears on the screen. For example, I defined the SST as SELECT TOP 100 * FROM. Notice how it works:

Create an automatic table inserts - Need to transfer information from one table to another table? You can perform insert select. On a remote server that's a bit more problematic, and small tables sometimes more convenient to produce a script of inserts. One possibility is to create the script using the scripting wizard, but have much faster way. Using the SSMS ToolsPack, can be accomplished with a single click on the table; choose SSMS Tools, then Generate Insert Statements.
You may choose whether to create the script file or a new Query window:
And that’s it, you get a beautiful working script


If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!


No comments:

Post a Comment