Microsoft KB Archive/283844

= FIX: DATEADD does not accept scientific notation for the NUMBER argument =

Article ID: 283844

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft SQL Server 2000 Windows CE Edition 1.1 Service Pack 1
 * Microsoft SQL Server 2000 Windows CE Edition 1.1
 * Microsoft Encarta Interactive World Atlas 2001
 * Microsoft SQL Server 2000 Windows CE Edition

-



This article was previously published under Q283844



SYMPTOMS
The Microsoft SQL Server CE DateAdd function returns a new datetime value based on adding an interval to a specified date.

When you call the DateAdd function and pass a value in scientific notation for the second argument, this error message occurs:

HRESULT: DB_E_ERRORSINCOMMAND

Minor Error: SSCE_M_QP_INVALIDFUNCTIONARGS (25922)

Source: Microsoft SQL Server for Windows CE

Description: One or more errors occurred during processing of command. Interface defining error: IID_ICommand



CAUSE
SQL Server CE is not casting the second argument to the appropriate type.



WORKAROUND
SQL Server CE supports BIGINT values for the second parameter of the DateAdd function. Avoid passing a value in scientific notation for this parameter.



RESOLUTION
To resolve this problem, obtain and install SQL Server 2000 Windows CE 2.0.



STATUS
This bug was corrected in Microsoft SQL Server 2000 Windows CE 2.0.



Steps To Reproduce The Problem
To reproduce the problem, open a connection to a SQL Server CE database in the SQL Server CE Query Analyzer and run the following statements: Drop Table t1 Create Table t1 (f1 int) Insert t1 Values (1e5) This statement works fine: Select Dateadd(dd, f1, '19750930') From t1 This statement fails: Select Dateadd(dd, 1e5, '19750930') From t1 ISQLW returns the following error details for the preceding statement:

HRESULT: DB_E_ERRORSINCOMMAND

Minor Error: SSCE_M_QP_INVALIDFUNCTIONARGS (25922)

Source: Microsoft SQL Server for Windows CE

Description: One or more errors occurred during processing of command. Interface defining error: IID_ICommand

Param. 0: 0

Param. 1: 0

Param. 2: 0

Param. 3: @dateadd

Param. 4:

Param. 5:

