Symptoms
You change the data type of a column in a database table from ntext to nvarchar(max) on a server that is running Microsoft SQL Server 2012, 2014 or 2016. When you update the table by adding more than 4,000 records, DBCC CHECKDB may report errors that resemble the following:
Msg 8961, Level 16, State 1, LineNumber
Table error: ObjectID, indexID, partitionID, allocUnitID (type LOB data). The off-row data node at page (PageID), slot 0, textID does not match its reference from page (PageID), slot 0. Msg 8961, Level 16, State 1, LineNumber Table error: ObjectID, indexID, partitionID, allocUnitID (type LOB data). The off-row data node at page (PageID), slot 0, textID does not match its reference from page (PageID), slot 0. Msg 8929, Level 16, State 1, LineNumber ObjectID, indexID, partitionID, allocUnitID (type In-row data): Errors found in off-row data with ID owned by data record identified by RID = (RID) DBCC results for 'TableName'. There are 1 rows in 1 pages for object "TableName". CHECKTABLE found 0 allocation errors and 3 consistency errors in table 'TableName' (ObjectID). repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKTABLE (DatabaseName.TableName). DBCC execution completed. If DBCC printed error messages, contact your system administrator.Resolution
This issue is fixed in the following cumulative updates for SQL Server:
Cumulative Update 5 for SQL Server 2016 RTM
Cumulative Update 2 for SQL Server 2016 SP1
Cumulative Update 4 for SQL Server 2014 SP2
Each new cumulative update for SQL Server contains all the hotfixes and security fixes that were included in the previous cumulative update.Check out the latest cumulative updates for SQL Server:
Latest cumulative update for SQL Server 2016
Workaround
To work around this issue after you change the data type, set the large value types out of row option to 1.
ALTER TABLE TableName ALTER COLUMN COLUMN_NAME nvarchar(max) NOT NULL
go
exec sp_tableoption 'TableName', 'large value types out of row', '1'
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
References
Learn about the terminology Microsoft uses to describe software updates.