sql - Cannot create row of size greater than 8060 (a wierd case for this error message) -


i getting error "cannot create row of size 8766 greater allowable maximum row size of 8060."

this happens in query has lot of columns, 300, of type "int" or "float". query calculates hrm report has 31 columns (one each day). posting query here take space, if insist, could. sure 300 columns of float (4 or 8 bytes) , varchars should never exceed 8060 bytes. still, error happens. problem is, happens in wierd way.

in first level of query, looks this:

select   title, k0present, k1present, k2present, ht,k0_t, case when bla bla bla bla when bla bla bla bla end y01, case when bla bla bla bla when bla bla bla bla end y02 ... case when bla bla bla bla when bla bla bla bla end y31 (_inner_query_) order title 

now, inner query has 300 columns. here in outer query have 37 columns. causes error message.

however, if change this:

select   *, case when bla bla bla bla when bla bla bla bla end y01, case when bla bla bla bla when bla bla bla bla end y02 ... case when bla bla bla bla when bla bla bla bla end y31 (_inner_query_) order title 

the error message gone! though there ~300 more coulmns in output window!

how work on solving problem? haven't got clue. maybe there's wierd going query optimizer? maybe somehow mis-optimizes query?

if physical data size less 8060 , still getting error, try following command.

dbcc cleantable example, dbcc cleantable (databasename,'tablename', 0) no_infomsgs; 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -