question

swarnava2014 avatar image
swarnava2014 asked

Getting error in SQL server like this : Cannot create a row of size 8549 which is greater than the allowable maximum row size of 8060

I have a select statement which is fetching data from 3 tables, total columns in select statement is approx 600. I am not inserting output of select statement in any tables.


Select statement is throwing error : Cannot create a row of size 8549 which is greater than the allowable maximum row size of 8060


Any suggestion will be greatly appreciated.


TIA

error-message
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered

When you JOIN two (or more) tables together, SQL Server creates a worktable to hold intermediate results. By the sound of your error message, this worktable is wider than 8060 bytes. And, given that you say this is around 600 columns, that's easily believable.


As for how to fix it... Do you really need all 600 columns returning to the application / user?


10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.