SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database Naming Convention


Database Naming Convention

Author
Message
Nemeaux
Nemeaux
SSC-Enthusiastic
SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)

Group: General Forum Members
Points: 144 Visits: 166
I have seen lots and lots of commentary and comments about naming SQL Server database objects. But what about the name of the database itself? Is there a definitive best practice standard for the naming of a relational database? Should the name be limited to a few characters? Should it be long and verbose? Somewhere in-between?

I would appreciate any thoughts everyone might have on this topic.

Thanks
laurie-789651
laurie-789651
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3596 Visits: 1272
I've never seen any convention on this. It's best to give a DB a short meaningful name with no spaces. Sometimes DB names may be for example suffixed with '_DEV', '_TEST' etc if you've got development databases on the same server. If you've got a number of DBs with very similar names it can be confusing so avoid this.
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)

Group: General Forum Members
Points: 144175 Visits: 18651
laurie-789651 (7/31/2013)
It's best to give a DB a short meaningful name with no spaces.


I agree with that. Make the database meaningful or even playful if you want. Spaces in the db name are a pain but they can be used in the db name.

The key is that you know what the database is and represents.

Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Learn Extended Events

RonKyle
RonKyle
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15727 Visits: 3906
Most would probably say it's overkill, but I prefix my OLTP databases with db, my staging areas with sa, and my OLAP database with dw. The names are otherwise short and clear.



Tom Thomson
Tom Thomson
SSC Guru
SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)

Group: General Forum Members
Points: 50589 Visits: 13157
laurie-789651 (7/31/2013)
I've never seen any convention on this. It's best to give a DB a short meaningful name with no spaces. Sometimes DB names may be for example suffixed with '_DEV', '_TEST' etc if you've got development databases on the same server. If you've got a number of DBs with very similar names it can be confusing so avoid this.
What an utterly horrible idea. So when my content_music and content_general databases go into production the system fails miserably because all the testing was done with SPs in content_general_test (whose name is changed to content_general in the release process) referring to tables in content_music_test (whose name is changed to content_music in the release process, so that content_music_test exists only on the test system, not on the production system).

OK, it's not likely to happen, if your release processes are reasonably professional. But I would strongly recommend not giving it the slightest chance to happen, and sticking "_TEST or _DEV or other postfixes on the database name in various stages of design, development, test, system test, pre-release validation, everything before release is just giving this particular failure a chance to happen in production.

Tom

Nemeaux
Nemeaux
SSC-Enthusiastic
SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)

Group: General Forum Members
Points: 144 Visits: 166
So what do you all think about database names as short as 5 characters in length? Which is a standard that is mandated where I work?
Nemeaux
Nemeaux
SSC-Enthusiastic
SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)

Group: General Forum Members
Points: 144 Visits: 166
Oops, sorry. The mandated standard here is 4 characters vice 5.
Tom Thomson
Tom Thomson
SSC Guru
SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)

Group: General Forum Members
Points: 50589 Visits: 13157
Nemeaux (7/31/2013)
So what do you all think about database names as short as 5 characters in length? Which is a standard that is mandated where I work?

Sounds crazy to me, for anything I've worked on. But I imagine there could be contexts in which it makes sense. So is where you work such a context? If so I'd love to hear about it, because I'm always interested in discovering things that are strange and new to me.

Tom

Nemeaux
Nemeaux
SSC-Enthusiastic
SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)SSC-Enthusiastic (144 reputation)

Group: General Forum Members
Points: 144 Visits: 166
I really don't think where I work is such a context. I can't really imagine limiting "production" database names to 4 characters in any context. Something about defeating the self-documentation aspect of longer names eludes me.

By the way, I didn't make nor do I subscribe to the aforementioned standard. I'm just searching for a rationale for the shorter database names, aside from laziness in referencing a database name in code.
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (221K reputation)SSC Guru (221K reputation)SSC Guru (221K reputation)SSC Guru (221K reputation)SSC Guru (221K reputation)SSC Guru (221K reputation)SSC Guru (221K reputation)SSC Guru (221K reputation)

Group: General Forum Members
Points: 221565 Visits: 33556
Clarity, clarity, clarity.

You need to make things clear. Keeping the names arbitrarily short does nothing but obscure meaning. You want to know what things are, quick, clear and simple. In fact, this should be your naming standard for everything. Keep things clear.

I'm also completely against naming databases based on the environment they are in. That makes things EXTREMELY difficult to manage for testing, coding, rollbacks from production, etc.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search