?
Solved

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

Posted on 2003-03-03
4
Medium Priority
?
568 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:show_t
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 23

Expert Comment

by:adathelad
ID: 8057889
Hi,

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

Cheers
0
 
LVL 69

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.

0
 
LVL 69

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).
0
 

Accepted Solution

by:
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
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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 ?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

764 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