T-SQL Tuesday #123: SSMS tips to make your day easier

February 11, 2020

I thank Jes Pomfret (blog|twitter) for hosting T-SQL Tuesday #123. The topic for this month is Life hacks to make your day easier. I also want to acknowledge Adam Machanic’s vision behind this project. I learned a lot from some of the #TSQL Tuesday’s and participated in a few. Thank you, Steve Jones (blog|twitter), for coordinating this program. If you are interested to see previous topics, visit here.

Opening SSMS as a different user

I have two Active Directory Accounts. Once I use to login to my workstation and everything except working inside Databases. For that, I needed to open the SQL Server Management Studio (SSMS) with my admin account. I created an instance of runas application on my desktop to do that. Saves me a few clicks and type in my user name and password every time I launch SSMS. Text of the target.

'C:\Windows\System32\runas.exe /user:DomainName\AdminAccount /savecred "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\SSMS.exe"'

Opening frequently used files

I use a project and a solution for my commonly used TSQL scripts and like to have that readily available when I open SSMS. If you do not know how to create a solution with TSQL scripts and use it in SSMS, read this blog post by Kenneth Fisher (blog|twitter). I add my solution path and file name to the above runas instance code.

'C:\Windows\System32\runas.exe /user:DomainName\AdminAccount /savecred "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\SSMS.exe C:\FrequentlyUsed\TSQLScripts.ssmssln" '

SSMS Key Shortcut

Keyboard shortcut in SSMS is a popular feature, and I am sure everyone uses those. My top 3 favorites are:

Navigate between open queries

CTRL+F6 will cycle through all tabs in the same order they were open. I find it hard to get to a specific script that I want. I find CTRL+TAB is a better option. It opens the window on the left. I can toggle between tool windows, and on the right side, I can navigate between all open queries. Query names are visible, which makes it easier to go to a window that I need at that time.

5 replies on “T-SQL Tuesday #123: SSMS tips to make your day easier”

Most important setting (not 100 % sure, if I tranlated the “menu structure” correct back to English):
Tools | Settings | Environement | Tabs and Windows | “Show pinned tabs in additional line”

This brings a lot of order in your open tabs (when you pin the most importants at least)

My favorite feature is to highlight a SQL statement such as EXEC myStoredProc; and then hit Debug and dive into the debugger and… oh wait, the Debug feature was removed in SSMS v18 :sadface:

I always move the status bar up, and remove everything but the file name from the tabs. My favorite keyboard shortcut: CTRL-SHIFT-V …. just like CTRL-V except you expose the clipboard contents in the order that you cut them :).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.