How to Spell and Capitalize tempdb for SQL Server

No matter what I write in this post, some of y’all are going to tell me I’m wrong. That’s inevitable, because I’m writing about tempdb: a database so complex and mysterious in SQL Server, that even the spelling and capitalization of the database name is a topic of great disagreement.

Note: nearly everyone has been inconsistent about this

You might think, “This is easy, just check Microsoft’s documentation to find the answer.”

That’s a great idea, except you’ll find multiple variations of “tempdb” on Microsoft.com:

  • This docs page uses TempDB
  • This docs page uses tempdb (lowercase even when first word in the title)
  • This support page uses tempdb (But “Tempdb” when title case is needed) — most Microsoft support pages seem to follow this pattern
  • Bob Dorr, one of my favorite Microsofties who writes on SQL Server, likes to use TEMPDB (all caps)
  • Pam Lahoud, another of my favorite Microsoft experts on SQL Server, uses tempdb (lowercase) but TEMPDB (all caps) in her title of this post

So the good news is, if you’re writing for casual usage, there are a lot of different alternate spellings out there, and that’s OK. Most people do NOT use a space and make “Temp DB” two words, but you’ll see variations of that around the internet as well.

However, it can be nice to have a sense of the “most accepted” current spelling and capitalization of a term. This is especially useful if you’re building a tool with a GUI and you want it to look as “standard” as possible, or if you’re writing for a company website.

Here’s my take on what’s won the contentious “tempdb” spelling and capitalization wars.

My recommendation is: tempdb, all lower case, but title cased as Tempdb when required

A few years back, I believe I saw Paul Randal point out on Twitter that tempdb is a real database, and the database is spelled tempdb. This simple argument has persuaded quite a few of us who write in the SQL Server world that there’s no use for any spaces in there, and that the “db” bit shouldn’t be capitalized. (Time has passed and I can’t find the tweet, so hopefully I’m attributing this correctly.)

A screenshot of the tempdb database appearing in SQL Server Management Studio's object explorer. "tempdb" is all lower case and one word.

You will find some variation in capitalization of tempdb on the SQL Skills blog, but Paul tends to use lowercase “tempdb” even at the beginning of a bullet point.

My colleague Kathi Kellenberger is the editor of Simple Talk. On posts she edits, she uses lower case tempdb, but there are exceptions as in when tempdb is the first word in an article title. (This is a good article to look at as a style guide, in my opinion.)

I have also noticed that other frequent writers in the Microsoft Data Platform space have standardized on “tempdb” somewhat, so if you choose this you are in good company:

I try to be consistent using “tempdb” on this site, and I mostly succeed at this lately. I tend to be massively inconsistent about title casing in general, but I do my best. (Truth: I didn’t even capitalize the title of this post like I usually do, I had to go back and edit it after publishing, haha.)

Thanks to Piers for the suggestion on this post

My colleague Piers is on the SQL Monitor team at Redgate. The team was chatting about how tempdb is so complicated that it’s not even obvious how to spell or capitalize it, and he said, “you know, maybe someone should write a blog post.” 💡

And there’s always room for one more post about tempdb, right?

5 Comments. Leave new

  • Hey Kendra – yes, that was me. I firmly believe ‘tempdb’ is the correct name, all lower case, just like ‘msdb’, ‘master’, and ‘model’. Those are their names inside SQL Server itself, so those are their proper names 🙂 Thanks

    Reply
  • To get code to work consistently regardless of the collation set then it should as stated be ‘tempdb’, as that IS the value in the system catalog. Having worked across db’s from many vendors over the past 30 years I’m still amazed at the number of SQL Server databases that use the standard out of the box case/accent insensitive setting. It’s wrong on so many levels!!!

    It would be a great blog post to give reasons why you ‘should’ use the standard out of the box collation. I would struggle to write it is as I can’t think of any 😉

    Reply
  • Jan Van der Eecken
    July 24, 2020 12:48 pm

    I guess you would get into trouble spelling it any way but “tempdb” if your database collation is case-sensitive?

    Reply
  • We help ourselves when we consistently use the case specified in the native tool, SSMS, for everything (database, schema, table, column, index, etc. names). In addition to code (DDL, DML, etc.), this includes documentation.

    Reply
  • I don’t know what you’re talking about Kendra, that docs page you link to above has tempdb all in lower case in every single reference 😉

    Reply

Leave a Reply to Pam Lahoud Cancel reply

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

Menu
%d bloggers like this: