SQL Prompt has some nice color coding features, but sometimes I want a database to keep the same color, regardless of instance. I don’t know that I’d recommend this, but since I work in demo environments across versions, this is a handy trick for me.
In the SQL Prompt menu, there is an options item.
Clicking this brings up a dialog with a number of sections along the left and details on the right. Near the bottom is the color menu.
When I decide to color code a database, I click “add” and I get this view. The cursor defaults to the Server/Group edit box, and I’ve typically entered a server name here.
However, I can skip this and just enter a database.
In this configuration, every time I open a query window to a database called SimpleTalk_1_Dev, no matter which instance, it will be colored purple.
I can see this when connecting to my default local instance.
I also test things on a v14 (SQL 2017) instance, and if I connect there, I see the same thing.
In some sense, this is an edge case. I demo similar things across instances and versions, and it’s nice to keep colors simple rather than entering dozens of instance names. However, it’s not something many people do, as they often use the same database name on different instances. That’s a more common scenario.
That’s supported as well. Notice here I’ve entered just a server with no database.
Now every database I connect to on this instance will be colored green. Note that the purple still overrides because it is specific to a database. The third tab below is connected to the SimpleTalk_1_Dev database.
SQL Prompt has some amazing features, but color coding is one that helps me keep track of which databases and instances I’m connected to in a query window. If you‘ve never configured this, give it a try.
If you’ve never tried SQL Prompt, it’s incredible. Download an eval today and see what you think.