Problems With VarChar

  • Hi my name is Ritesh.

    In my table I am using varchar 8000 and have set this is design view. I am typing in some text in this field but cannot type more than 1023 or there abouts. Why is that ?

    I thought varchar 8000 lets you type in upto 8000 characters.

    Help!!

    Regards

    Ritesh

  • Hi,

    Where do you type your text ? In SQL Server Enterprise Manager ?

    A varchar column can indeed contain up to 8.000 characters (nvarchar up to 4.000 because unicode needs 2 bytes for each character).

    Regards

    Thierry

  • You can only have 8k per row. So, only if all other columns are empty can you have 8k in one varchar. You must always add up the total of your columns and make sure the total doesnt go over 8k when you create a table. You should use a blob field instead of 8k varchar in most cases.

  • The maximum size for a VARCHAR field is 8000 characters.  The maximum number of bytes per row is 8060 in SQL 2000.  This allowed for upto 60 bytes of other data in the row to describe or identify the row.  In SQL 2005, this limit has been removed because a row can now span multiple pages.

    If you need a field larger than 8000 characters, SQL 2005 introduced a new data type VARCHAR(MAX) which holds up to 2^30 characters.

    BLOB data is difficult to work with using normal string manipulation functions and should only be used when needed, not in "most cases" where character data is stored.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply