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.](https://littlekendra.com/wp-content/uploads/2020/07/image.png)
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:
- Paul White, who has written more deep technical content on tempdb than anyone else I know, uses tempdb
- Erik Darling uses “tempdb” in this new post on SQL Server 2019’s in-memory features for tempdb
- Andy Mallon uses “tempdb” as he reminds you to stop shrinking your tempdb
- As mentioned above, recent Microsoft support pages have largely standardized on this style
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?