SQlServer 2005 varchar/nvarchar datatype size

I've heard that  SQLServer 2005 has introduce 2GB of data to its varchar,nvarchar datatypes. That was cool. But when I tried the foll. code

Declare @var varchar(max)

set @var=replicate('A',16000)

Print len(@var)

It gave me 8000. I'as preety flammoxed. then i cam accross the fact that these datatypes increase with a fixed size of 8000. so i tried the foll.

 

Declare @var varchar(max)

set @var=replicate('A',8000)

set @var =@var + replicate('A',8000)

Print len(@var)

 

this gave me 16000

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
Print | posted on Thursday, July 27, 2006 3:12 AM

Feedback

# re: SQlServer 2005 varchar/nvarchar datatype size

left by Pankaj at 3/26/2009 12:59 AM Gravatar
Hi i am pankaj and i working as database developer and we use the side for geting the good code. Actually mai i want to get more knoweldg from the database sqlser ver and get the best result
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: