August 21, 2014 at 6:28 am
Ed Wagner (8/21/2014)
Nice question, thanks. But I'm with Koen - I've never used a table name that long and I expect to be beaten by someone if I do.
:hehe:
August 21, 2014 at 8:20 am
TomThomson (8/21/2014)
twin.devil (8/21/2014)
Just for the information.Becuase #table names max length is only 116 characters in SQL Server 2008 r2. its also valid of SQL SERVER 2012.
It's valid in every version from SQL Server 2005 to SQL Server 2014 inclusive. Probably in SQL Server 2000 too, but I haven't kept a copy of the transact-sql reference for SQL Server 2000 so I'm only 99.5% certain of that.
.
yup, its confimed.
text from sql server 2000 help file (from the CREATE TABLE statement)
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.
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
August 21, 2014 at 8:41 am
Ed Wagner (8/21/2014)
Nice question, thanks. But I'm with Koen - I've never used a table name that long and I expect to be beaten by someone if I do.
Amen to that!
August 21, 2014 at 10:49 am
Raghavendra Mudugal (8/21/2014)
TomThomson (8/21/2014)
twin.devil (8/21/2014)
Just for the information.Becuase #table names max length is only 116 characters in SQL Server 2008 r2. its also valid of SQL SERVER 2012.
It's valid in every version from SQL Server 2005 to SQL Server 2014 inclusive. Probably in SQL Server 2000 too, but I haven't kept a copy of the transact-sql reference for SQL Server 2000 so I'm only 99.5% certain of that.
.
yup, its confimed.
text from sql server 2000 help file (from the CREATE TABLE statement)
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.
Looks like global temp tables (##) will allow up to 128 characters just like standard tables. Tested in 2008R2.
August 21, 2014 at 11:28 am
tested it, got only one message, so , what ?
August 21, 2014 at 11:49 pm
crussell-931424 (8/21/2014)
Thank you for the question.
+1
Nice easy one
Thanks
August 22, 2014 at 12:09 pm
Raghavendra Mudugal (8/21/2014)
TomThomson (8/21/2014)
twin.devil (8/21/2014)
Just for the information.Becuase #table names max length is only 116 characters in SQL Server 2008 r2. its also valid of SQL SERVER 2012.
It's valid in every version from SQL Server 2005 to SQL Server 2014 inclusive. Probably in SQL Server 2000 too, but I haven't kept a copy of the transact-sql reference for SQL Server 2000 so I'm only 99.5% certain of that.
.
yup, its confimed.
text from sql server 2000 help file (from the CREATE TABLE statement)
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.
Nice Find.
IMHO - that needs to be updated so a temp table can be 128 characters too.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 22, 2014 at 1:18 pm
SQLRNNR (8/22/2014)
Raghavendra Mudugal (8/21/2014)
TomThomson (8/21/2014)
twin.devil (8/21/2014)
Just for the information.Becuase #table names max length is only 116 characters in SQL Server 2008 r2. its also valid of SQL SERVER 2012.
It's valid in every version from SQL Server 2005 to SQL Server 2014 inclusive. Probably in SQL Server 2000 too, but I haven't kept a copy of the transact-sql reference for SQL Server 2000 so I'm only 99.5% certain of that.
.
yup, its confimed.
text from sql server 2000 help file (from the CREATE TABLE statement)
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.
Nice Find.
IMHO - that needs to be updated so a temp table can be 128 characters too.
It won't be updated.
The reason for the shorter maximum length for temp table names is that SQL Server internally adds some characters to the name. That way, you can create a table #tmp1 and I can create a table #tmp1 on the same server, and we will not be in each other's way.
Can this be changed? Probably. But given how often I have sat behind my keyboard cursing the fact that I was unable to add a 117th character to the name (aka "never"), I have a very long list of things I much rather see the SQL Server development team work on!
August 22, 2014 at 1:55 pm
Hugo Kornelis (8/22/2014)
It won't be updated.
The reason for the shorter maximum length for temp table names is that SQL Server internally adds some characters to the name. That way, you can create a table #tmp1 and I can create a table #tmp1 on the same server, and we will not be in each other's way.
Can this be changed? Probably. But given how often I have sat behind my keyboard cursing the fact that I was unable to add a 117th character to the name (aka "never"), I have a very long list of things I much rather see the SQL Server development team work on!
Good point!
August 22, 2014 at 2:42 pm
Hany Helmy (8/21/2014)
Koen Verbeeck (8/21/2014)
Thanks for the question. I didn't know about this limitation. (because who comes up with a 116 character table name?)No one 🙂
+1 ... I mean +116 :-p
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply