varchar datatype - difference in max and 8000

Posted by Nagasundar_Tn under Sql Server on 9/22/2012 | Points: 10 | Views : 1226 | Status : [Member] | Replies : 3
Hi Experts,

I have a basic doubt in SQL Server 2005. If we declare a column with varchar(8000) then we can insert upto 8000 characters into that column. If we declare varchar(max) then we can insert upto (2 ^ 31)-1 characters into that column.

My doubt is why we are unable to declare varchar(8001) onwards. varchar datatype supports upto 2^31-1 characters but unable to give varchar(8001).


Pls forgive me for this silly question...

Regards,
T.N.Nagasundar



Responses

Posted by: Jayakumars on: 9/22/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

sql sever 2005 design datatype may be
varchar(8000) if u need varchar(8000)> then use put max after brackets


Mark as Answer if its helpful to you

Nagasundar_Tn, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nagasundar_Tn on: 9/22/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

Thanks for you response. But my doubt is since varchar supports upto 2 GB of data why I am unable to define varchar(8001). Are there any constraint on it? Pls help me in detail

Regards,
T.N.Nagasundar

Nagasundar_Tn, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/22/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

yes if u can use varchar(max) this is allow large data then move to sql server 2008 also there allow large

Please mark as answer if it helpful to you.

Mark as Answer if its helpful to you

Nagasundar_Tn, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response