Link to home
Start Free TrialLog in
Avatar of show_t
show_t

asked on

Cannot create a row of size 8142 which is greater than the allowable maximum of 8060

Hi,

I've got a table with 160 fields.  They are all necessary.  Problem is that every now and then i get an error message saying "Cannot create a row of size 8142 which is greater than the allowable maximum of 8060" when i try and save a record to the database.  

Help
:-)

Thanks
Avatar of adathelad
adathelad
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi,

Can you split the fields into a number of tables / normalise the database structure?

Cheers
Avatar of Scott Pletcher
Unfortunately, there is NO way to create a row longer than 8060 total bytes, and that length also includes many overhead bytes for SQL Server itself.  That is the max available data bytes on a page, and SQL will NOT split one row across pages (it doesn't have the internal logic to allow it to do that).

You could try to reduce the total length of all columns by 82 bytes (or more).  Or, you could create another table for 82+ bytes worth of the least frequently accessed columns and then join to that table when needed.

You could also try converting a lengthy varchar column(s) to text, but that makes it much harder to use and manipulate the column, so that should be a last resort (text column use only 16 bytes of the main row -- the rest of the data is stored in separate pages).
ASKER CERTIFIED SOLUTION
Avatar of gnicoli
gnicoli

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