Thursday, March 29, 2012

Database Naming

am doing some testing on a database created by the programming dept of the
company, they named the database '123v10'.
When I run some queries (mostly admin stuff, checking the fragmentation,
space used by the data and log files, etc) in the Query Analyzer, I often
get the error message:
Line 1: Incorrect syntax near '123'.
My guess is that SQL doesn't particularly like database names that start
with numbers, am I correct? If so, will this create any real problems down
the line? I think we are at an early enough stage that the database could
be renamed if this would help.
TIA,
Nancy L> My guess is that SQL doesn't particularly like database names that start
> with numbers, am I correct? If so, will this create any real problems
> down
> the line? I think we are at an early enough stage that the database could
> be renamed if this would help.
Yes, you are correct. However, it should not cause problems if you code
defensively (which you should be doing anyways). The problem is that the
creator of the name did not follow the rules for regular identifiers. If
you don't follow the rules, then you must take extra steps to properly
delimit the identifier name (this includes all object names - databases,
triggers, procedures, tables, etc.). Obviously, the easiest approach is to
follow the rules.|||"Scott Morris" <bogus@.bogus.com> wrote in message
news:eUt9vPN$FHA.360@.TK2MSFTNGP09.phx.gbl...
> Yes, you are correct. However, it should not cause problems if you code
> defensively (which you should be doing anyways). The problem is that the
> creator of the name did not follow the rules for regular identifiers. If
> you don't follow the rules, then you must take extra steps to properly
> delimit the identifier name (this includes all object names - databases,
> triggers, procedures, tables, etc.). Obviously, the easiest approach is
> to follow the rules.
>
To add to that. Ensure that you use square brackets [ ] whenever you
reference the db name.
Rick Sawtell|||You may get it to work by using brackets around the db name like [123xxx],
however, somewhere down the road there will perhaps be a query or
application that will choke on it. It would be best to nip it in the bud
now.
"Nancy Lytle" <word_diva@.hotmail.com> wrote in message
news:O0YWoDN$FHA.216@.TK2MSFTNGP15.phx.gbl...
> am doing some testing on a database created by the programming dept of the
> company, they named the database '123v10'.
> When I run some queries (mostly admin stuff, checking the fragmentation,
> space used by the data and log files, etc) in the Query Analyzer, I often
> get the error message:
> Line 1: Incorrect syntax near '123'.
> My guess is that SQL doesn't particularly like database names that start
> with numbers, am I correct? If so, will this create any real problems
> down
> the line? I think we are at an early enough stage that the database could
> be renamed if this would help.
> TIA,
> Nancy L
>

No comments:

Post a Comment