Best New(ish) SSMS Feature

Categories: News, Professional, SSC
Comments: 2 Comments
Published on: December 26, 2017

We all probably use SQL Server Management Studio (SSMS) on a very frequent basis. Just for giggles, lets just say that means we use it at least once a day. I think it is safe to say, we have all been wanting to see something cool released for SSMS for a very long time.

That is probably one of the big reasons for various other third party offerings and people bouncing from IDE to IDE or Management Tool to Management Tool. They just weren’t getting what they really wanted out of SSMS.

A couple of months ago, while sitting in a session about Service Broker, I saw the weirdest thing in the SSMS interface and was awe struck. Quickly I turned to my trusty magic blue box to google what it was that I was seeing. It turns out I had been living under a rock apparently because this was not a new feature. Rather, it had been out for multiple releases (at that time) of SSMS.

What was that gob smacking feature that I saw? That feature was (and still is) the scrollbar map. What is the scrollbar map, you ask? I will share that with you!

Scrollbar Map

The scrollbar map is this neat little replacement for the traditional scrollbar. The map gives a miniature code map in place of the scrollbar so you can quickly see the rough gist of your code in the scrollbar. Here is what it looks like.

In the preceding image, I have a segment of code active on my screen in SSMS. On the right of that, in place of the traditional scrollbar, I see a representation of the entire script in super tiny print. The active portion of my script is “highlighted” by a box on the map. Just like any scrollbar, I can slide it to any point in the script easily – or I can click on a spot in the map and be moved to that spot in the script.

So, when did this feature come about? After-all, It seemed brand new to me back in the beginning of November and many have said it was a part of SSMS 17.3. The scrollbar map has actually been around since SSMS 16.

Accessing and setting up the map is pretty easy. You can either right click the scrollbar and select “scrollbar options” or you can navigate the tools menu to options and follow the tree like shown in the preceding image. In the preceding image, I am showing my current configuration for the map. These are my preferences and I do recommend that both be enabled. That said, the choice is yours.

The second option: “Show Preview Tooltip” will look something like this.

In this image, I have my mouse hovering over a segment of code in the map. As I hover, a little preview box pops up to the left of the map (outlined in a red box in my image).

Enabling the scrollbar map has saved me oodles of time – even without the preview option enabled. I can much more quickly hop to different segments of code with this feature than I could if trying to scroll up and down trying to find that one little section I need.

Try it out. Play with the map. I think if you spend a lot of time bouncing around in TSQL scripts, you will find that this feature can and will save you time too.

Do You Solution?

Comments: No Comments
Published on: March 29, 2011

Do you ever find yourself working on different scripts at once?  Maybe you are working on something that tests certain functionality in SQL Server, you have some presentation scripts you are working on, and possibly three or four scripts related to a project at work.  I find myself in a situation like this from time to time – multiple scripts open checking this or that.

How do you organize your scripts?  Do you leave them all open in SSMS?  Do you create a folder structure on your disk somewhere and set yourself a reminder task?  I have left them all open in SSMS on occasion because I wanted to come back to them and work on them and it can help remind me where I am in the thought process and what needs to be done next.

Did you know that there is a feature in SSMS to help you with organizing yourself?  It’s not there just to help you get organized – but it can also help with efficiency and recoverability of files.  I’ll explain the recoverability a bit later.

SSMS has a feature called “Solution Explorer.”  Much like Visual Studio or BIDs (which is Visual Studio), you have the ability to create a solution file to manage your projects.  This solution can then be stored on disk and updated as you progress through the solution or projects.

If you want to display this feature, click the View Menu from the toolbar and then select “Solution Explorer.”  This will open a new pane in your management studio from which you can add new or existing projects as well as rename the solution.  To the right is an example of one of my solutions.  In this image, you can see that I have two projects displayed associated with this particular solution.  In these projects, I have loaded numerous script files for each of the projects as I work on them.  Some of these scripts are testing the results of stored procs, while others may be stored procs, and yet others may be tables.  What the script performs immaterial to Solution Explorer.

Should I decide that I need multiple files open from the project, I can highlight them all and open them all at once.  Nothing earth shattering, but now I have an easy way to see the files associated with each task or project as I work on the task/project.

The project files are stored in XML format and are saved off to disk in a directory of your liking.  An unfortunate problem with this kind of storage is the sorting of your scripts in the project.  Despite this problem there is a way to fix it.  I found the fix for that at this blog.  It is nice to have scripts sorted properly to your liking.  I recommend giving that blog a read and I would recommend the use of this feature in SSMS – if you aren’t doing something already (for instance in Visual Studio, SVN or something like that).

I like having the ability to see all of the scripts quickly that I may need on the same screen I am working in.  I can bounce quickly between the scripts as needed and I don’t necessarily have to keep them open indefinitely while working out the task at hand.

I mentioned earlier that it also helps with the recoverability of files.  Let me explain a bit.  Have you ever been in the middle of working on a script and then the dreaded forced shutdown occurs due to updates?  Just in case you did not get your files saved, SSMS has an autorecover feature as well as an autosave feature.  Files that are Autorecover and Autosave (recovered) are saved commonly in Solution1.  They are stored in your user profile directory and can be brought back so you can continue working on them.

Should you need to find these files, here is a common path you can use to retrieve them.

%userprofile%\Documents\SQL Server Management Studio\Backup Files\Solution1

Do you want to learn more about this feature?  Check out the Microsoft documentation on the topic.  You can view that here.

Something that I really like about this feature is the ability to create a script either directly in the project, add an existing script, or take a script that you started working on outside of the project and move it into the project from within SSMS.  It took me a bit of looking to find how to add a script from SSMS directly to the project (when not initiated from within the project).  It is really easy to do once you find it.  Here is how to do it.

With the focus in SSMS active on the script you wish to move, click on the File menu.  From the File menu you will have an option to Move the script that you are currently working on in SSMS.  From there Select the appropriate project and it is that simple.

*Note: In the example of the image being displayed, you can see that the query was SQLQuery1.sql that I wanted to move.

page 1 of 1

Calendar
July 2018
M T W T F S S
« Jun    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Welcome , today is Sunday, July 22, 2018