Click to See Complete Forum and Search --> : Datatype Length Question


jrkeyboard
05-05-2006, 10:36 AM
If I have a field that could be as few as 0 characters, or as much as 8000 characters (Could probably use more, but I think that's the max allowed)... I plan on using a varchar field... but my question is this. If I specify a length of 8000 characters, and 2 people enter stuff. The first person leaves the box empty, the next person puts in 4000 characters.

Do these both take up the same amount of storage space, or does it only store the actual characters that are put in there?

Or, would it be bette to use a datatype of text?

Thanks

Don

chazzy
05-05-2006, 11:18 AM
what dbms are you using? some have a limit of 255 to varchars..

russell
05-05-2006, 11:20 AM
If you are using MS SQL Server, then (a) The max is 8000 and (b) the storage used is the number of bytes in the data -- in your example 0 for the first guy and 4000 for the other.

jrkeyboard
05-05-2006, 11:40 AM
Thanks russell... yes, I am using MS SQL Server, and that's exactly what I needed

Thanks