Avoid . In Your Database Name

Just a word of advice from an inexperienced programmer, avoid naming your SQL database with . (dot) in SQL Server.

Warning:  Might contain jargons after the jump.

While you thought adding a dot in your database name seems harmless, then think again.  I recently named a database with a dot, since we are installing a new version of an application and I would like to create a new database instead of overriding the old one.

Harmless it seems, I named it ‘application1.2_site’ (just an example).  Interestingly enough, Microsoft allows this.

Now, what I get is an error from a stored procedure which removes expired subscription, saying that server name ‘application1′ does not exist.

Because of the dot, the SQL Server thinks application1 is a server name and 2_site is the database name.  Hence, problem happens.

To remind you all again, avoid . (dot) in your database like plague.

Post a Comment

Your email is never shared. Required fields are marked *

*
*