I have this communication when I’m trying add new object to my local database:
The table definition or the row size exceeds the maximum row size of 8060 bytes.
My table has the following structure:
[Table]
public class SomeClass
{
[Column(IsPrimaryKey = true, IsDbGenerated = true, CanBeNull = false, AutoSync = AutoSync.OnInsert)]
public int Id { get; set; }
[Column]
public string String1 { get; set; }
[Column]
public string String2 { get; set; }
[Column]
public string String3 { get; set; }
[Column]
public string String4 { get; set; }
}
3 of these strings (String2, String3, String4) will contain the 2000-3000 characters.
When I am trying to write smaller data (between 1000 to 1500 characters) everything works.
How can I fix this?
SQL Server stores the records in pages, pages are 8k, and therefore a records cannot exceed that size (difference to 8k is administrative date).
You need to change your text column definitions to
text,ntext, orvarchar(max),nvarchar(max)to store longer texts. These blob columns are not restricted by page size.