SQLTeam.com | Weblogs | Forums

Data Type Size


#1

I Want a Char DataType which can store maximum data.
I mean which has max data storing capacity


#2

varchar(max) or nvarchar(max)

but be careful how you use them. be sure you really need max. what are you planning on storing? there may be a better way


#3

Hi gbritton
Actually I was creating a dynamic query for pivoting some values but it contains more than 8000 char I think which a varchar(max) can store but I have more data then that...any solution regarding that


#4
declare @sqlquery nvarchar(max);
set @sqlquery = N'select 42 as "the answer"'
exec sp_executesql @sqlquery;

#5

I was using this only but the char charatcter size is exceeding and ita getting only that much data that it can store at max.
Can you tell me exact size how much character it can store . I have read somewhere that it can store upto 8008 char


#6

true, that's why you might want nvarchar(max). Basically char and varchar are limited to 8000 bytes since they need to fit in a page.


#7

varchar(max) From BOL: "max indicates that the maximum storage size is 2^31-1 bytes (2 GB)." How are you executing your dynamic SQL? Can we see that line of code?