Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm initializing SQL Server replication from a backup, by following instructions from here:


...but, when I execute

USE MyDatabase
EXEC sp_addsubscription 
@publication = MyDatabasePublication, 
@subscriber = 'AMAZONA-XXXXXXX', 
@destination_db = MyDatabase,
@sync_type = 'initialize with backup',
@backupdevicetype ='disk',
@backupdevicename = 'D:\Temp\MyDatabasepublication.bak'

I get the following error:

Msg 8115, Level 16, State 2, Procedure sp_MSsetupnosyncsubscriptionwithlsn, Line 237
Arithmetic overflow error converting expression to data type nvarchar.

Any idea why, or at least where can I find this stored procedure to troubleshoot further?

SQL Server 2012, Standard Edition.

UPDATE: It looks like that the problem is caused by the fact that database was created using SQL Server 2008R2 and then attached here. Anyway, still need a solution for it.

share|improve this question

migrated from serverfault.com Apr 29 '13 at 12:37

This question came from our site for professional system and network administrators.

I'm guessing that cross version initialization from backup isn't supported, but I'm checking for you. –  mrdenny Apr 29 '13 at 12:54
So someone who has a similar configuration was able to test the config and it does work between SQL 2008 and SQL Server 2012. I'd recommend firing up profiler or an XEvent session on the subscriber and seeing what internal errors are being generated that aren't exposed. Might be useful info in there. –  mrdenny Apr 29 '13 at 15:37
By chance, does it have billions of rows in the replicated tables? If so, it's a known bug: connect.microsoft.com/SQLServer/feedback/details/723133/… –  Brent Ozar Aug 6 at 16:37

2 Answers 2

Here is something, although MS says it relates only to MS SQL Server 7.0 Standard Edition, you may wish to check it out.

This article on MSDN KB: FIX: Replication Agents May Fail With Arithmetic Overflow Errors Due to Large Latencies. It suggests that

When the delivery latencies of replication agents are high, the stored procedures that compute average delivery latency report the following error message: Error 8115 Sev 16 Arithmetic overflow error converting %ls to data type %ls.

There is a workaround provided with recomendation to install SP3 for SQL Server 7.0.

share|improve this answer

Ran into same issue today morning. I do not think this is because of the SQL 2008 r2 version database put on SQL 2012. Looks like a bug to me. Every time I dropped and recreated or attempted to recreate the subscription it was trying to use new AgentID and looks like the older versions SQL was running out of ID's. Removed replication completely and recreated publication one by one and did not run into any issues this time.

Though the article talks about 2005, this could be a bug in SQL 2012. http://support.microsoft.com/kb/948622

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.