all groups > sql server programming > october 2003 >
You're in the

sql server programming

group:

Db name starting with numbers


Db name starting with numbers Rulle
10/30/2003 11:40:08 PM
sql server programming:
I have a db named 90db.
When I try to execute "Use 90mydb" an error occurs (syntax
error near mydb). Apparently the compiler interprets the
beginning as a number and cant swallow the dbname.
Is this a known phenomenen? Any documentation?

Re: Db name starting with numbers Rulle
10/31/2003 1:24:52 AM
Ok, thanks!


[quoted text, click to view]
Re: Db name starting with numbers Narayana Vyas Kondreddi
10/31/2003 7:37:04 AM
Try this:

USE [90DB]
GO

--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm




[quoted text, click to view]
I have a db named 90db.
When I try to execute "Use 90mydb" an error occurs (syntax
error near mydb). Apparently the compiler interprets the
beginning as a number and cant swallow the dbname.
Is this a known phenomenen? Any documentation?

Thanks!

Re: Db name starting with numbers Tibor Karaszi
10/31/2003 8:44:08 AM
Don't name objects like this. Read in books Online about "standard identifiers" and "delimited
identifiers". I recommend keeping all names within the rules for standard identifiers. If you do
not, you need to:
USE "dbname"
or
USE [dbname]

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

Re: Db name starting with numbers Joe Celko
11/5/2003 1:44:16 PM
[quoted text, click to view]

I am sure nobody would immediately know what that database models from
that name. What is scary is that the 90 sounds like a value, which
would mean that you are attribute splitting at the database level -- a
horrible design flaw!

[quoted text, click to view]
can't swallow the dbname. <<

This is Standard SQL, and every ISO Standard language I can think of.
You can screw up readability and portability for for maintenance
programmers by putting the name in double quote marks. The use square
brackets for the same functionality is proprietary.

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button