Wayne Sheffield

My blog about SQL Server

Browsing Posts tagged SSMS Tips

You may have noticed that in many places in SSMS, you can create a new item and SSMS opens up a template for you to fill in – for instance, when creating a new stored procedure. Have you ever wondered where SSMS gets the template from? You can view all of the templates from SSMS’ […]

Have you ever wished for a visual indicator that you are connected to a production instance of SQL Server? Well, you can change the status bar to any color that you want for any instance. In the Connect to Server dialog, select the Options button. Then select the “Connection Properties” tab, check the “Use Custom […]

You may have noticed that there are many menu commands that don’t have a keyboard shortcut. For instance, SQLCMD mode under the query menu. You can easily add a keyboard shortcut to any menu item that you desire. Just right-click on the toolbar, and select customize. Then select Keyboard: Search for the menu item that […]

There are several shortcuts that can be assigned to run a stored procedure. Known as Query Shortcuts, these can be assigned to the Alt+F1, Ctrl+F1 and the Ctrl+# keys. For instance, highlight sys.databases below and press Alt+F1. sp_help will run against sys.databases, and it will produce the following output: This makes for an easy way […]

Did you know that items in the Object Explorer can be dragged and dropped into a query window? This can be a real time saver! Drag the database name to have it put into the query window. Grab the table name and drag it to the FROM clause. Drag the entire Columns node of a […]

We’re all used to using the clipboard in Windows programs. You copy something into it with Ctrl+C, and paste it into your document with Ctrl+V. However, did you know that the SSMS clipboard remembers the last 20 items that were put into the clipboard, and that you can cycle through all of these clipboard values? […]

In yesterday’s tip, I showed an example of changing a block of text from upper case to lower case. However, I didn’t show how to actually change the text. Just select the text, and use the keyboard shortcuts Ctrl+Shift+U or Ctrl+Shift+L to change the text to upper case or lower case respectfully. Like most things […]

While Regular Expressions lets us work with text not cleanly formatted, if you are trying to work with text that lines up, there is an easier way to do things. Starting with SSMS 2012, you can use Block Select/Replace (note that this is actually a Windows feature, so it works in other programs that handle […]

Have you ever downloaded a script from an internet site, only to find that there are extra blank lines between all the lines of code? Or perhaps you have results that you need to extract information from in SSMS, but the data isn’t in a clean format? Do you go through and change things line […]

Have you ever had to run a query on multiple servers? You could connect to each server one by one to run it. Or you could create a script with each instance in it (using the :CONNECT command – see yesterday’s tip). But these are the hard ways of doing it. The easier way is […]