(Rogue group microsoft.public.sqlserver removed from crosspost)
On Fri, 15 Apr 2005 14:48:11 -0400, genc_ymeri wrote:
Quote:
Hi,
We are a team that are developing a projet which has in itself a good number of tables in sql server (not temporary ones !). The entire team is pretty knowledgeable in MSSQL server and in SQL programming in general.... However we kind of want to double check what are the limitations of naming tables (not temporary ones ! "#"). ?
e.g
1. Any limit of the length of the characters in table name ?
2. Any special characters which are not allowed or is not advised to be in a table name ?
3. or any other constrains or limitations I can't think of now.
Thank you very much in advance,
G.Y
Software Engineer,
QuadraMed, Reston VA |
Hi G.Y.,
Table names must adhere to the rules for regular identifiers. Here's a
copy and paste from Books Online:
=== start copied text ===
Rules for Regular Identifiers
The rules for the format of regular identifiers are dependent on the
database compatibility level, which can be set with sp_dbcmptlevel. For
more information, see sp_dbcmptlevel. When the compatibility level is
80, the rules are:
The first character must be one of the following:
A letter as defined by the Unicode Standard 2.0. The Unicode definition
of letters includes Latin characters from a through z and from A through
Z, in addition to letter characters from other languages.
The underscore (_), "at" sign (@), or number sign (#).
Certain symbols at the beginning of an identifier have special meaning
in SQL Server. An identifier beginning with the "at" sign denotes a
local variable or parameter. An identifier beginning with a number sign
denotes a temporary table or procedure. An identifier beginning with
double number signs (##) denotes a global temporary object.
Some Transact-SQL functions have names that start with double at signs
(@@). To avoid confusion with these functions, it is recommended that
you do not use names that start with @@.
Subsequent characters can be:
Letters as defined in the Unicode Standard 2.0.
Decimal numbers from either Basic Latin or other national scripts.
The "at" sign, dollar sign ($), number sign, or underscore.
The identifier must not be a Transact-SQL reserved word. SQL Server
reserves both the uppercase and lowercase versions of reserved words.
Embedded spaces or special characters are not allowed.
When used in Transact-SQL statements, identifiers that fail to comply
with these rules must be delimited by double quotation marks or
brackets.
=== end copied text ===
The maximum length of table names can also be found in Books Online, in
the Maximum Capacity Specifications:
Identifier length (in characters) 128
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)