SQL Snapshot Replication Fails with BCP EOF / NULL Errors (Works in Transactional Replication)
Issue:
We have Snapshot Replication on a production server that was working fine but recently started failing with the below error:
Agent message code 20037. The process could not bulk copy into table "XXX".
Message: End of file reached, terminator missing or field data incomplete
Message:Batch send failed
Message: Failed to send batch after max errors
More details:
Publisher & Distributor: Microsoft SQL Server 2017 (RTM-CU31-GDR) (KB5084818) - 14.0.3525.1 (X64) Standard Edition on Windows Server 2016 Datacenter
Subscriber:
- Microsoft SQL Server 2022 (RTM-CU24-GDR) (KB5083252) - 16.0.4250.1 (X64) Standard Edition on Windows Server 2022 Datacenter
- Microsoft SQL Server 2017 (RTM-CU31-GDR) - 14.0.3525.1 (X64) Standard Edition on Windows Server 2016 Datacenter
What we tried:
- Dropped table on subscriber + deleted snapshot folder + reinitialized → worked temporarily
- Issue reoccurred; same steps no longer fix it
- Created new Snapshot Replication → same failure for this table
- Created Transactional Replication with same table → works fine
Issue occurs only in Snapshot Replication
Findings:
• Suspected issue with datetime2(7) and SNAC 11.0 (BCP native mode)
• Snapshot Agent appears to generate multiple .bcp files (parallel processing)
Quick Solution Workaround (working):
- To avoid generating multiple .bcp files per table (parallel processing), we added a row filter (WHERE 1 = 1) to the affected articles.
Questions:
- Is this a known issue with Snapshot Replication multi-threaded BCP?
- Does SNAC 11.0 have limitations with datetime2(7)?
- As we cannot add the same filter to every table (due to scale), will upgrading to OLE DB / ODBC Driver 17 or 18 resolve this?
- Is there a way to disable BCP partitioning globally (without using row filters)?