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

Posted on 2003-03-03
Medium Priority
Last Modified: 2007-12-19

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.  


Question by:show_t
  • 2
LVL 23

Expert Comment

ID: 8057889

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

LVL 70

Expert Comment

by:Scott Pletcher
ID: 8057907
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.

LVL 70

Expert Comment

by:Scott Pletcher
ID: 8057919
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).

Accepted Solution

gnicoli earned 150 total points
ID: 8063512
The maximum leght can vary in reason of the field's type. In any case cannot be over 8192 bytes. The workaround can be:
1. downsize the field's type (bigint vs int vs smallint vs tinyint, datetime vs smalldatetime, char vs varchar, nchar/nvarchar vs char/varchar) to gain free bytes for all the fields.
2. split the table in two or more table with referential constraint and cardinality one to one; in other words the primary key of the two (or more...) table must be identical in the number and in the type of the fields

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question