Symptoms
Assume that you use transactional replication in Microsoft SQL Server 2008, and there is an update query running on the publication. When you upgrade the SQL Server to SQL Server 2012 or SQL Server 2014, and the update query is not distributed before the upgrade, the Log Reader Agent may fail with the following error:
<Date> <Time> Publisher: {call sp_replcmds (500, 0, 0, , 0, 500000)}
<Date> <Time> Status: 0, code: 20011, text: 'The process could not execute 'sp_replcmds' on '< Publisher Name>'.'. <Date> <Time> The process could not execute 'sp_replcmds' on '<Publisher Name>'. <Date> <Time> Repl Agent Status: 6 <Date> <Time> Status: 0, code: 542, text: 'An invalid datetime value was encountered. Value exceeds the year 9999.'. <Date> <Time> Status: 0, code: 3621, text: 'The statement has been terminated.'. <Date> <Time> Status: 0, code: 22037, text: 'The process could not execute 'sp_replcmds' on '<Publisher Name>'.'.Even if this problem has not happened, upgraded log records for update statements can still be misinterpreted by Log Reader Agent and the following error can arise in Distribution Agent:
515 Cannot insert the value NULL into column '<Column Name>', table '<Table Name>'; column does not allow nulls. UPDATE fails.
Note
-
Different data types and constraints can cause different error to be reported, and this problem even can cause non-convergence.
-
The issue occurs when you upgrade from SQL Server 2008 or SQL Server 2008 R2 to SQL Server 2012 or SQL Server 2014.
Resolution
If the error "515 Cannot insert the value NULL into column '<Column Name>', table '<Table Name>'; column does not allow nulls. UPDATE fails" in Distribution Agent has occurred, you should reinitialize your replication. This hotfix does not fix this error. To avoid this error, you should disable the Log Reader Agent before upgrade, then upgrade all the way to this fix, and then re-enable the Log Reader Agent.
The issue was first fixed in the following cumulative update of SQL Server.Cumulative Update 2 for SQL Server 2012 SP2 /en-us/help/2983175
Cumulative Update 3 for SQL Server 2014 /en-us/help/2984923
Cumulative Update 11 for SQL Server 2012 SP1 /en-us/help/2975396
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.