Feb 052018

While programming, I often need to view different parts of a file at the same time. Consider a long stored procedure: the list of parameters is at the top and it may be helpful to reference them when working elsewhere in the code. I could scroll repeatedly between the top of the file and wherever I am working, but that becomes annoying rather quickly, in addition to wasting time.

Fortunately, SQL Server Management Studio, which is built on Visual Studio, has a wonderful solution to this. Each file has a splitter located in the top right corner.

File Splitter: hiding in plain sight

Simply grab the splitter and drag down to split the file. You now have two independent views of the same file! It’s a huge time saver, and it’s easy!

SQL Operations Studio (which at the time of this writing is still in preview) addresses this problem differently. Rather than having two different views of a file per tab, it lets you open a file multiple times. To do this, right-click on a file in the explorer window, and choose “open to the side”.

This accomplishes the goal of letting you view multiple areas of a file at once, but in my opinion it’s much less optimal. You need a wider window for it to work (as proven by my narrow video for this post) and depending on the width of your code, that may not be convenient.

All things considered, I prefer SSMS’ implementation, and I have to imagine that anyone who has worked in SSMS or Visual Studio for a while would say the same. I have high hopes for SQL Operations Studio, especially since it is still in preview. I don’t expect SSMS feature parity in this new tool, but I hope horizontal file splitting eventually makes it into the product.

Sep 092016

A while back, I wrote about how SQL Prompt now includes execution warnings and how useful I think that feature is. It’s saved my bacon several times now, including just last week!

I’m now happy to announce that I’ve recorded a demo video of this feature for Redgate’s series of #SuperSQLTips for SQL Prompt. Be sure to check out my video, as well as the rest of the series – there’s some super-helpful stuff in there!


Jul 142015

I’m so happy to be able to contribute to this month’s T-SQL Tuesday! Andy Yun picked an excellent topic: default settings. Defaults exist for a reason: in the absence of a user’s preference, they represent the option that the application’s author(s) believe will generally work the best for the greatest number of people.

All that being said, if you’re reading this blog, you probably aren’t the average computer user, and you probably aren’t a fan of all the default settings your applications choose. I’ve got plenty of defaults for different applications that I despise and do my best to change as quickly as possible. Here’s a few that really grind my gears:

Windows File Extensions

I like to see the full names of my files, including the extension (the “.”, typically followed by 3 or 4 characters after the file name).  Windows tries to be helpful and by default doesn’t show the extension if it recognizes the file type. For example, the Microsoft Word document “Letter to Grandma.docx” would be shown as simply “Letter to Grandma”. This may be fine for many, but I’m not a fan.

No file extensions. Boooo.

File extensions. Much better!

To enable their display in Windows 7 (yes, that’s what I use at home) from any Windows Explorer window, go to “Organize” > “Folder and Search Options”, then the “View” tab. Here you’ll find a list of checkboxes, one of them is called “Hide extensions for known file types”. Uncheck this box and you’ll be able to see the extensions for all files, not just the ones Windows can identify.

Hidden Files

Not only do I like to see file extensions, I also like to see all my files. Windows allows files to be marked as hidden, which means they still exist on disk, just they are not displayed in Windows Explorer. While this can be useful to keep prying eyes away from files, it is not a security feature in any way, shape, or form.

To enable the display of hidden files, go back to the very same window we found the file extension option in (“Organize” > “Folder and Search Options” > “View” tab). The list of checkboxes has a section for “Hidden files and folders”, and its options are “Don’t show hidden files, folders, or drives” or “Show hidden files, folders, or drives.” Now you’ll be able to see everything.

Line Numbers in SQL Server Management Studio

This is primarily a SQL Server blog, after all, so I had better include something SQL-specific. SSMS has plenty of default options that are worth changing, but one of the first ones I take care of is adding line numbers. I like to be able to quickly see what line I’m on by glancing at the left margin of the query window. I understand why the default doesn’t include them, but being a programmer at heart, I like to see them. They comfort me.

To add line numbers in SSMS, go to Tools, then Options. Under “Text Editor”, select “All Languages”, then check the box to display line numbers.

(click to enlarge)

So there you have them, arguably my top 3 favorite defaults to change. I hope you found this helpful, and thank you Andy for the excellent topic!

Dec 012010

I’m sure this one’s been in SQL Server Management Studio for quite a while, but I never noticed it before now.

Let’s say you’re running a batch in SSMS containing 2 T-SQL Statements. For simplicity’s sake, I’ll do some selects from my Numbers table:

The “Results” tab appears with 2 result sets. The first has 10 rows, and the second has 100. The rows counter at the bottom right says “110 rows”. All of is exactly what I’ve come to expect. (Click on any screenshot to enlarge)

Row count for the combined result sets:

But wait, there’s more! If you click in the top result set, that counter will change to say only 10 rows. Click on the bottom set and it now says 100. Click back in the query window and it again shows the combined total of 110.


Nifty, eh? Again, I’m sure this is nothing new, just I had never noticed this behavior in SSMS before. Happy querying!