locked
Database Name guidelines - start with a number? RRS feed

  • Question

  • I've been searching and reading for the past 1/2 hr around SQL database names must follow the identifiers rules.  One of those rules leads me to believe that the database name cannot start with a number (0-9) Microsoft SQL Identifiers - so I'm thinking "123456789" would not work.  But it does:

    And the database is successfully created:

    Created SQL database

    SQL database 123456789 has been created on server xyzsqlserverdev in resource group sql-data-prototype.

    So am I safe in proceeding to create some databases that may start with a 0-9?  The reason I'm doing this is to abstract db names to a GUID without the dashes, so something like:  "4581332871ba4e24a577c17881488ffd"

    Thank you in advance.


    Bill Blakey

    Friday, April 5, 2019 9:55 PM

All replies

  • Hi Bill,

    Yes, you are free to use that database name string value. Not until you enter an invalid value does an error present itself with a list of invalid values.

    Friday, April 5, 2019 10:59 PM
  • When you use database names that don't conform to regular identifier naming rules, they must be enclosed in square brackets or double-quotes for use in T-SQL. Consider prefixing the name with an alphabetic character (e.g. D4581332871ba4e24a577c17881488ffd) for your situation to avoid that requirement.


    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    Saturday, April 6, 2019 4:22 AM