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
 General SQL Server Forums
 New to SQL Server Programming
 max lenght Column Name??

Author  Topic 

Thanh Minh
Starting Member

8 Posts

Posted - 2008-07-23 : 05:05:16
how much lenght of column name?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 05:07:04
SELECT * FROM INFORMATION_SCHEMA.COLUMN, LEN(COLUMN_NAME)
ORDER BY LEN(COLUMN_NAME) DESC


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-23 : 05:09:51
or do you meant the max length allowed? 128 i think

Em
Go to Top of Page

Thanh Minh
Starting Member

8 Posts

Posted - 2008-07-23 : 05:13:36
or do you meant the max length allowed? 128 i think ---> sure???
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-23 : 05:21:28
maximum identifier length is 128 characters. try more and see what you get?

Em
Go to Top of Page

Thanh Minh
Starting Member

8 Posts

Posted - 2008-07-23 : 05:30:47
i input more than 62 character then error
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 05:47:25
Do you use UNICODE collation? A unicode character occupies 2 bytes.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Thanh Minh
Starting Member

8 Posts

Posted - 2008-07-23 : 05:49:53
i use ADO to create table, when input column name over 64 characters then error. how to input over 64 characters now? help me!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 05:50:59
Do you use UNICODE collation? A unicode character occupies 2 bytes.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-23 : 05:57:11
quote:
Originally posted by Thanh Minh

i use ADO to create table, when input column name over 64 characters then error. how to input over 64 characters now? help me!


i think you are using unicode as told by Peso
Go to Top of Page

Thanh Minh
Starting Member

8 Posts

Posted - 2008-07-23 : 06:16:41
thanks, i will check it.
Go to Top of Page

arutla
Starting Member

4 Posts

Posted - 2008-07-23 : 07:31:07
May i know what unicode is??
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-23 : 10:43:26
datatypes like nvarchar,nchar,..are unicode data types.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-07-23 : 12:22:12
UNICODE.....

http://unicode.org/

basically, allows support for different locales / character sets / alphabets / symbols / etc / etc

-------------
Charlie
Go to Top of Page

neeraj_sharma
Starting Member

15 Posts

Posted - 2013-07-01 : 07:42:56
how much lenght of column name in sql server?

its is 128 characters i have tested this

Check

Declare @a varchar(max)

SET @a = replicate ('a',129)

Exec ( 'create table '+@a+' (ID INT)')

REF
http://www.tutorialsqlserver.com/Create/Create-Table-in-Sql-Server-Part-2.htm





Neeraj Prasad

Tutorial Sql Server
Go to Top of Page

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-07-01 : 08:51:05
Extend Neeraj's example:


Declare @b nvarchar(max)

SET @b = replicate (N'?',129)

Exec ( 'create table '+@b+' (ID INT)')

You get the following message:
Msg 103, Level 15, State 4, Line 1
The identifier that starts with '????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????' is too long. Maximum length is 128.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2013-07-02 : 11:11:33
object names must be SYSNAME types

SYSNAME is a virtual type that is really just a NVARCHAR(128)

and all objects must obey that restriction (which may change in future versions -- it used to be 30 characters max in the old days.)

http://msdn.microsoft.com/en-us/library/ms191240%28v=sql.105%29.aspx


Transact Charlie
Msg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.
http://nosqlsolution.blogspot.co.uk/
Go to Top of Page
   

- Advertisement -