SQL Prompt to the Rescue With Tab Coloring
Ever drop a database in the wrong environment? Rollbacks are fun, aren't they? SQL Prompt offers simple, colorful visual cues to tell which environment you're working in.
Join the DZone community and get the full member experience.Join For Free
when you’re hard at work, it’s all too easy to make a mistake as you rush to get a job done. say, for example, you have a qa database you need to get rid of. you run a query to drop it and then… oh no! you’ve accidentally run it in production.
your day just got even busier. you have to stop whatever you’re doing, restore to a point in time on your production server and start over. if only there were an easier way to tell which environment you were working in.
good news: there is!
tab coloring with sql prompt
there’s already a very helpful feature within sql prompt called tab coloring which lets you quickly and easily identify the environment you’re working in within ssms.
to get started, go to options in sql prompt and find this feature under tabs> color :
add your server or database, and choose the environment from the drop-down menu. we’ve set up some default options, but you can edit the colors and add more if you wish by clicking edit environments . you can add as many as you like.
as soon as you click ok, you’ll see your open tabs change color to match their environment.
you can tell immediately here that you’re in production because the tab is bright red, and therefore you need to be careful when you run a
tab coloring for groups
if you set a tab color for a group, then all servers within that group will be assigned the same color. this is useful if you’re working on multiple groups at once and want to quickly distinguish between their related tabs.
tab coloring for servers
if you want to set a color for an individual server you can do that too. if you’ve already set up a group color, you can overwrite that color for an individual server by setting a new color. this can be helpful if you want to mark all of your production servers as a different color regardless of group, for example. remember that if you set a group color after you set your server color, that will change the server color, so be sure to follow this process in the right order.
tab coloring for databases
you can also set different tab colors for individual databases. this won’t change your server or group tab colors when you set these.
we love sql prompt tab coloring in ssms because it gives you that additional reminder to ensure you’re not doing something you may regret on your production system, plus it helps you organize your tabs to help you work more efficiently.
want to find out more?
data platform mvp grant fritchey explains how to use sql prompt to color your tabs in the following video:
if you’re not a sql prompt user, download a free trial and see how much more productive you can be writing code every day.
Published at DZone with permission of Jamie Wallis, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.