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):
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 informationA 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 notesInstall the following Windows Installer packages in the following sequence:
PrerequisitesTo apply this hotfix, you must have Sync Framework 2.1 installed.
Restart requirementYou do not have to restart the computer after you apply this hotfix if affected files are not being used.
Hotfix replacement informationThis hotfix does not replace any other hotfix.
File informationThe 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|
The following code uses an illustrative hexadecimal value (0x00000000A0171FB0). When you run the code, you receive a negative integer value:
The correct implementation is to cast the @@dbts value to the BIGINT data type value before any calculations:
Declare @TS timestamp
select @TS +1 ====>>>>>> this gives a negative value: -1609097295
Declare @TS timestamp
select convert(bigint,@TS) +1 ====>>>>>> this gives a correct time stamp value