Database Administrators are a finicky bunch. They fret over fine details and fuss over imperfections in our code.

It’s not that they obsess over these things because they enjoy it.

(Okay, some actually do enjoy that.)

They do it as a defense mechanism against messing up production data, causing an outage, or losing their job. They do it because it’s their responsibility to prevent database forest fires from the stray sparks of bad code. In short, they have a lot on the line and their attention to detail is limited.

Here’s one thing you can do to help that they will appreciate. You can give them one less detail to focus on with every script you hand them.

Try this: For every script you write, start by typing the letters U-S-E.

USE WideWorldImporters

This might not seem like it’s a big deal, but it is. Here’s why:

Context is easy to mess up

If you open a new query in Management Studio, chances are it’ll default to pointing at the master database. That’s practically never the correct database for that script to run in. Sure, clicking the drop-down and changing to the correct database is easy.

But that step gets missed. A LOT.

I’ve accidentally run scripts in master more times than I could possibly count. I bet your DBA has, too.

Context can be hard to track down

If there isn’t a USE statement in the script, where will the DBA get that information? What if multiple databases have the same tables? Is it possible to tell them apart without USE?

If you’re using a system like Team Foundation Server or some other work tracking system, your DBA may have to go back into the system and read the user story or task again in order to find the database context. If they’ve already closed that window, that may mean logging in, searching for the item, and reading the description thoroughly. If they can’t establish that context with certainty, they may have to call you and ask for it.

Why not save both of you the trouble?

It’s the little things

DBAs are often more task-oriented than project-oriented (especially the operational DBAs). This means they’re continually being pulled in different directions. They’re having to mentally switch context all the time. If you can relieve them of even one of their two hundred decisions in a day, you’re helping make them sharper, make your code deployments more reliable, and letting them know you care.

Give it a try. Secretly replace the beginning of your script with Folgers crystals and see if it brightens their day.