Link to home
Start Free TrialLog in
Avatar of chuang4630
chuang4630

asked on

How to bypass the SQL limit on record length?

How to bypass the SQL limit on record length?

I have to ALTER table to add several fields. The error meesage is as follows:

Warning: The table 'MoodyDataExport' has been created but its maximum row size (9007) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.

How do I bypass that? How do I know the record length?
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
leew,

Just a comment from the peanut gallery and a pet peeve of mine.  It is a myth that "accented characters" are unicode and require a unicode data type.  They are not and never have required 2  bytes.  I can insert (and so can you) the following sentence in any varchar column with sufficient length:

Este es el mito más grande del año:  Se necesita dos bytes para caracteres con accento.

Try it.  If you prefer a shorter string use this one:
áéíóúñü


And it would probably help if I could spell :)  

It should be:
Este es el mito más grande del año:  Se necesita dos bytes para caracteres con acento.

Avatar of dave4dl
dave4dl

Thats a good answer leew.

As an additional note, if you convert your large string fields to a TEXT or NTEXT data type, you can search those fields with the "like" operator.
Yes, that's true - extended ASCII characters (128-255) include many accented characters.  
The above suggestions apply to SQL Server 7.0 and SQL Server 2000.  You can also move to SQL Server 2005 where you have two additional options.  One is that rows CAN exceed 8K, although individual columns can not.  The other is to declare some of your Varchar (nvarchar, varbinary) columns to be Varchar(Max).  These new datatypes replace TEXT/NTEXT with full Varchar (etc.) functionality.