Wayne Sheffield

My blog about SQL Server

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 […]

Have you ever had a script where you needed to run parts of it on different instances of SQL Server (for example, to set up database mirroring)? Wouldn’t it be so much easier if you could just have commands, within the script, to connect to the various servers and run that portion of code? Of […]

Do you have scripts that you need to run frequently, but every time you need to set some different parameters? Are you tired of looking for all of these? Well, Template Variables in SSMS allow you to easily set all of these variables quickly and easily. A template variable is a special notation within a […]

Have you ever had a long script that you are trying to scroll through? Do you wish that you could see a preview of the scroll area to easily see what section you are in? Well, starting in SSMS 2016, you can. Just right-click the vertical scroll bar, and select “Scroll Bar Options…” When you […]

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close