How to troubleshoot - "Incorrect syntax near - Source: MSSQLServer, Error number: 102)" errors in replication

A quick guide on how to troubleshoot Incorrect syntax near - Source: MSSQLServer, Error number: 102)" errors in replication

Firstly, check for any known issues like https://support.microsoft.com/kb/935563 by searching with the error message in bing

If there is no known issue, run a profiler by connecting to the subscriber because these errors are reported while applying the changes at the subscriber

In the profiler, enable all the Events under "Errors and Warnings", "Stored Procedures" and start the distribution agent

Once the distribution agent fails, stop the profiler and search for the "Incorrect Syntax" message

Now try to correlate the command which was running in that session and find out why it had failed

You can also copy the stored procedure call and paste in SQL Server Management Studio to find out the reason for syntax error

Now that you have found the syntax error, figure out yourself on how to fix it or skip that transaction as per the steps mentioned in https://blogs.msdn.com/b/chrissk/archive/2009/09/08/how-to-skip-a-transaction-in-sql-2005-2008-transactional-replication.aspx

Post your comments if you have any questions.

 

Sakthivel Chidambaram, SQL Server Support

Microsoft