hs2d
hs2d

Reputation: 6199

SQL Server : maximum row size warning

I have table with over 100 columns what are varchar(200). We are changing all the columns to nvarchar but when running the alter script we are getting a warning message like this:

Warning: The table "TABLE_NAME" has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit.

Should I be alarmed by this or can I just ignore it?

Upvotes: 0

Views: 2742

Answers (1)

IVNSTN
IVNSTN

Reputation: 9318

The problem is actual even without moving to nvarchar - 200 bytes for each of 100 columns is 20000 bytes per row. Max row size in SQL Server is 8060 as given in warning text. It is only a warning because columns are varchar which means they occupy as much space as they really need to store current data starting from zero. But if total length of all column exceeds max bound for any row - it will fail - server won't be able to store that row. That's what this warning is about.

Upvotes: 1

Related Questions