I would like to know what is the maximum size of varchar
in SQL Server 2000. While I was googling somewhere it was written 8000 characters and somewhere it was written 8060 bytes. Which one is correct?
varchar [ ( n | max ) ] Variable-size string data. Use n to define the string size in bytes and can be a value from 1 through 8,000 or use max to indicate a column constraint size up to a maximum storage of 2^31-1 bytes (2 GB).
Storage Information : The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used. Make sure you are aware of the effects of a multi-byte character set. VARCHAR(255) stores 255 characters, which may be more than 255 bytes.
About varchar(MAX)If your data is longer than 8000 characters varchar(MAX) is what you need. You can store up to 2GB size of data this way. In varchar(MAX) fields if your data size is shorter than 8000 characters your data is stored in row automatically (therefore the data execution is faster).
Varchar is 8000 and nvarchar is 4000.
Here's the varchar msdn reference:
http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With