FIX: "System.OverflowException: Value was either too large or too small" error message when you perform data synchronization by using Sync Framework 2.1


When you use Microsoft Sync Framework 2.1 to perform data synchronization, you may receive the following error message:
System.OverflowException: Value was either too large or too small for a UInt64. At System.Int64.
Additionally, when you run the following code against the problematic database to check the @@dbts value, you will find that the value is greater than the limitation of an Integer data type value (2147483647):
select @@dbts
Note @@DBTS returns the last-used time stamp value of the database.


This issue occurs because Sync Framework performs some calculations on @@dbts after converting the @@dbts value to the Integer data type value. However, when the @dbts value is greater than 2147483647, the value is converted to a negative integer value. Therefore, an OverflowException exception occurs in the later calculations.


Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website: Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Installation notes

Install the following Windows Installer packages in the following sequence:
  1. Synchronization-<KB>-v2.1-<arch>-<lang>.msi
  2. ProviderServices-<KB>-v2.1-<arch>-<lang>.msi
  3. DatabaseProviders-<KB>-v3.1-<arch>-<lang>.msi
Note Install the Windows Installer packages only if you have the corresponding components installed on the computer. For example, do not install the ProviderServices-<KB>-v2.1-<arch>-<lang>.msi file if you do not have Sync Framework 2.1 Provider Services installed on the computer.


To apply this hotfix, you must have Sync Framework 2.1 installed.

Restart requirement

You do not have to restart the computer after you apply this hotfix if affected files are not being used.

Hotfix replacement information

This hotfix does not replace any other hotfix.

File information

The global version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
File name File version File size Date Time Platform 3.1.2508.0 280,816 05-May-2012 06:18 x86 3.1.2508.0 280,816 05-May-2012 06:18 amd64

More Information

The following code uses an illustrative hexadecimal value (0x00000000A0171FB0). When you run the code, you receive a negative integer value:
Declare @TS timestamp 
Set @TS=0x00000000A0171FB0
select @TS +1 ====>>>>>> this gives a negative value: -1609097295
The correct implementation is to cast the @@dbts value to the BIGINT data type value before any calculations:
Declare @TS timestamp 
Set @TS=0x00000000A0171FB0
select convert(bigint,@TS) +1 ====>>>>>> this gives a correct time stamp value


For more information about @@dbts, visit the following MSDN website: