Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Table name

Author  Topic 

SQLfriends
Starting Member

12 Posts

Posted - 2002-09-25 : 14:37:16
Can we programmatically assign a current date (e.g. getDate()) to a table name?

Thanks.

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-09-25 : 14:53:00
sure...use dynamic sql to execute your CREATE TABLE statement.

Jay White
{0}
Go to Top of Page

solart
Posting Yak Master

148 Posts

Posted - 2002-09-25 : 15:06:03
From BOL

table_name

Is the name of the new table. Table names must conform to the rules for identifiers. The combination of owner.table_name must be unique within the database. table_name can contain a maximum of 128 characters, except for local temporary table names (names prefixed with a single number sign (#)) that cannot exceed 116 characters.

identifier
The name of an object in a database. An identifier can be from 1 through 128 characters.


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.

HTHs solart



Go to Top of Page
   

- Advertisement -