Monday, March 12, 2012

List of Table Name that not supported by SQL Database ?

Is anyone know about waht type of table or database name

that not supported or will have error during execution of SQL statement

in SQL or MS Access database. For my, I know only two ,

i.) cannot put table name that same as the the database name

ii.) cannot put database name like "RETURN", "POSITION",etc.

Is there any reference site that show out a list of table about the

table or database name ? Thank You ... :)

One way of avoiding duplicate names (I believe usually SQL tells you this if a table already exists) is to add different words to the beginning of the table name like "TheCustomers" or "TheUsers" - adding "the" at the start on 99% of occasions avoids name clashes with SQL data tables.

Thread moved to SQL forums

|||

In BOL (Books On Line) you can read about the rules for identifiers (ie what a 'legal' table/column name may look like) and BOL also has a list of reserved keywords.

Search for 'Using identifiers' for the namingrules, in BOL 2k there's a link on that page to 'Reserved Keywords'.

/Kenneth

|||

these are actually reserve keywords

but you can actually use them as table name if you qualify it

with quotes or square brackets as shown in the example below

create table [return]
(
field1 varchar(200),
field2 varchar(200)
)

select * from [return]

drop table [return]

|||

Yes, it's true that with square brackets you can have something named [1234] even though that is an illegal name according to the naming rules for identifiers.

I'm not too keen on using this 'backdoor' just to do stuff that you shouldn't do in the first place, so I never mention it. =;o)
If you decide to do this just because it's possible to do so, or as the first resort, it will bite you, likely sooner than later. There is no turning back.
Once an illegal name is in there (by virtue of square bracketing), all references from that moment must also be done by square bracketing.. (similar to nullhandling in a sense) or you may be facing spending some considerate time hunting for mysterious errors, that may be just someone who forgot the brackets...

/Kenneth

No comments:

Post a Comment