20 March 2017

1 Comment

20 March 2017

1 Comment

SQL Prompt to the rescue with tab coloring

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.

SQL Prompt tab coloring 2
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 DROP DATABASE statement.

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.

Like this? Share it with other SQL professionals using the social sharing buttons below. Simply tweet: I’ve just read @redgate’s blog on coloring tabs with #SQLPrompt – see the #SuperSQLTip at http://rd.gt/2mlbrGs.

Tools in this post

SQL Prompt

Write, format, and refactor SQL effortlessly in SQL Server Management Studio and Visual Studio.

Find out more

Share this post.

Share on FacebookShare on Google+Share on LinkedInTweet about this on Twitter

You may also like

  • Article

    SQL Prompt Code Analysis: INSERT INTO a permanent table with ORDER BY (PE020)

    The SQL query that is used to produce the result that is inserted into the permanent table has its order specified by an ORDER BY statement. Relational tables are not ordered, so the ORDER BY is meaningless. Use a Row_Number() window clause instead, if you need to impose a particular order on rows in the

  • Article

    Driving up database coding standards using SQL Prompt

    Most of us in the data management industry will have learned to adapt, in recent years, to ‘agile’ development and deployment practices. Many organizations have invested heavily in the tools and processes they hope will allow them to deliver new functionality to users more frequently and reliably, while also maintaining quality standards. To achieve this,

  • Article

    Beyond Formatting: Improving SQL Code using SQL Prompt Actions

    In this article, I’ll discuss how I use the SQL Prompt actions that you can apply as part of the Format SQL command. These actions are designed to help improve the overall quality of your SQL code, in various subtle but meaningful ways, such as qualifying object names, standardizing the use of aliases, adding semicolons

  • Article

    Customizing the SQL Prompt built-in snippets: a better 'ata' snippet

    Snippets are a great feature of SQL Prompt. They save coding time, and introduce standards and consistency to the way you build code modules. They have multiple replacement points (placeholders) for parameters, and you can invoke them directly from an SSMS query pane. SQL Prompt also comes with many useful built-in snippets, but sometimes we

  • Article

    SQL Prompt Code Analysis: Avoid using the ISNUMERIC Function (E1029)

    Avoid using the IsNumeric() function, because it can often lead to data type conversion errors, when importing data. SQL Prompt Code Analysis rules include an Execution rule, E1029, which will alert you to use of this function, in your T-SQL. If you’re working on SQL Server 2012 or later, it’s much better to use the Try_Convert()or

  • Forums

    SQL Prompt Forum

    Write, format, and refactor SQL effortlessly

  • Jezbers

    Love SQL Prompt. If I ever have to work in an environment without it my productivity drops at least 50%. The colours are something I only became aware of 6 months ago, really useful. Like all things Redgate, super simple, super useful.