We encountered a very strange behaviour that happened only once in a few years of production of our application: An update happened via "normal" ADO.NET out of a WinForms app on a database table and a field of that table that should have remained 0 in this update contains now a value in the order of 3 billion. The field in the database is specified as decimal(18,2) and the SQLParameter used in .NET when calling the update procedure is also set to decimal with the right scale and precision.

(We have a simple update procedure that just takes all fields of that table as parameters and updates all values of the specified row.)

We have never seen this situation before and looking at the code there is no calculation around this field that could possibly end up with this high value.

I know this is a broad question, but where would you be looking for an error in this case? It happened only once and it is not reproducable. (We restored for example the databases and the application to the right point in time and replayed the user action leading to this strange behaviour. The field wasn't updated to such a crazy value in that scenario.)

We are using SP4.

  • 2
    Would you care to provide the UPDATE statement? Feb 23 '17 at 21:24
  • Are all input value fields numeric datatypes? Could it be a string? Any regional settings that could affect number format? Feb 24 '17 at 5:50
  • Are you doing anything with dates and 3rd party code? I had a similar problem with an Oracle Database with a Java front end which then fed into a SQL server system for reporting. If a zero/null date was stored in Oracle via the Java app then it would become 01/01/0000. The date was not passed to SQL, but the Day Number i.e. number of days since 01/01/0000. Unfortunately SQL would use the number to produce a date based on 01/01/1900. There are 31 Billion Seconds since 01/01/0000 (a single zero out from your 3 million).
    – pacreely
    Feb 25 '17 at 17:19
  • sorry. dumb moment. Not one zero. But I'm sure you get the point.
    – pacreely
    Feb 25 '17 at 17:31