Conversion error while synchronizing two SQL Server 2008 databases RRS feed

  • Question

  • Hi all,

    I use Sync framework to synchronize two SQL Server 2008 databases.

    One of the tables from one side contains decimal columns with precision 38. Sync process throws an error:


    Conversion overflows.

       at System.Data.SqlClient.SqlBuffer.get_Decimal()

       at System.Data.SqlClient.SqlBuffer.get_Value()

       at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)

       at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)

       at Microsoft.Synchronization.Data.DbDataReaderHandler.SetRemainingColumns(DataRow row, IDataReader reader)

       at Microsoft.Synchronization.Data.DbDataReaderHandler.PopulateFullRow(IDataReader reader, DataRow row, RowEnumerationState state)

       at Microsoft.Synchronization.Data.RelationalSyncProvider.EnumerateChangesInternal(DbSyncScopeMetadata scopeMetadata)

       at Microsoft.Synchronization.Data.RelationalSyncProvider.GetChanges(DbSyncScopeMetadata scopeMetadata, DbSyncSession DbSyncSession, UInt32 memoryBatchSize)

       at Microsoft.Synchronization.Data.RelationalSyncProvider.GetChangeBatch(UInt32 batchSize, SyncKnowledge destinationKnowledge, Object& changeDataRetriever)

       at Microsoft.Synchronization.KnowledgeProviderProxy.GetChangeBatch(UInt32 dwBatchSize, ISyncKnowledge pSyncKnowledge, ISyncChangeBatch& ppChangeBatch, Object& ppUnkDataRetriever)


    It is a known problem for sql data adapters that they can use only decimals with precision 28. However, we are not able to change column precision. I know that while loading with data adapters ReturnProviderSpecificTypes flag can be used, however we are unable to intercept this while using sync framework.

    Is there a way how we can cheat the synchronizer? I have tried to put converters but the exception is thrown before there is any converter involvement.

    Thanks in advance!

    Thursday, November 24, 2011 8:06 AM

All replies

  • the error that you are encountering is at the SqlClient itself and not with Sync Framework.  as you mentioned, the exception you are getting is a known limitation (see: http://support.microsoft.com/kb/932288).

    looking at the sync framework code, the sync fuction that calls that failing function doesnt seem to have any publicly available hooks to influence the behaviour. (its calling ExecuteReader()). and this code executes even before you get to the converter part.

    if you're fine rounding it up, you can modify the select changes sp directly.


    Thursday, November 24, 2011 9:16 AM
  • Thank you, June, the answer is clear and very helpful.

    I hope guys from MS will provide a public property for such a situation.

    Thursday, November 24, 2011 12:53 PM