SQLServerException - Cannot create a row of size that is too large

3
I'm getting the below error on committing one specific entity: Failed to Commit (…) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot create a row of size 10168 which is greater than the allowable maximum row size of 8060. The error message is pretty clear, but our investigation raised some interesting points: This entity has 29 attributes and 6 associations. There are entities with more attributes/larger attributes that have no problems to commit. Reducing the string lengths does not solve the problem. There's no unlimited values in the entity and setting strings to unlimited also does not help.   Any ideas on what could cause this issue and what could resolve it? Database definition:     [id] [bigint] NOT NULL,     [attributename] [nvarchar](3) NULL,     [attributename] [nvarchar](8) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](2000) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](2000) NULL,     [attributename] [nvarchar](3) NULL,     [attributename] [decimal](28, 8) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](5) NULL,     [attributename] [nvarchar](3) NULL,     [attributename] [nvarchar](3) NULL,     [attributename] [nvarchar](11) NULL,     [attributename] [nvarchar](3) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](11) NULL,     [attributename] [nvarchar](1) NULL,     [attributename] [int] NULL,     [attributename] [nvarchar](7) NULL,     [attributename] [int] NULL,     [attributename] [nvarchar](3) NULL,     [attributename] [nvarchar](34) NULL,     [attributename] [nvarchar](200) NULL,     [attributename] [nvarchar](5) NULL,
asked
4 answers
1

Based on the specs saying: "This restriction does not apply to varchar(max), nvarchar(max), varbinary(max), text, image, or xml columns."

I would expect your issue to be resolved if you change (a subset of) your columns to unlimited lenght, as I would expect those to be created as nvarchar(max) by Mendix. I understand you saying you already tried this. Maybe try doing this for all columns and going from there?

answered
1

Based on my reading here, the max size for a table row is 8000 bytes. A varchar(2000) takes up 2000 bytes, but an nvarchar(2000) takes up 4000. So, just your 2 nvarchar(2000) columns overrun what SQL Server allows.

When you change the 2000-length attributes to unlimited, can you verify that they are altered to nvarchar(max) in SQL Server? Perhaps they aren’t being changed by the platform, because that should fix your problem. If that’s the case, it’s a bug and worth submitting a support ticket.

If just changing the data type doesn’t work, I’d try this next:

  • copy-paste a duplicate of your entity in the domain model
  • delete the original
  • change the 2 2000-length attributes to unlimited length
  • rename the copied entity back to the original name to fix references in the model
  • run/deploy

I expect that process would rebuild the table entirely with a new internal ID, and you should see those two long strings become nvarchar(max) columns.

answered
0

It can't hurt to post the definition for this table (should be easy to retrieve it with SQL Server Explorer or whatever Microsoft calls their Database tooling nowadays) here.

answered
0

it with SQL Server Explorer or whatever Microsoft calls their Database tooling nowadays) here. Redtube Beeg Spankbang 

answered