FIX: DATEADD does not accept scientific notation for the NUMBER argument (283844)



The information in this article applies to:

  • Microsoft SQL Server 2000 Windows CE Edition 1.1 SP1
  • Microsoft SQL Server 2000 Windows CE Edition 1.1
  • 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.

MORE INFORMATION

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:

					

REFERENCES

For additional information, see the "DATEADD function" topic in SQL Server CE Books Online.

Modification Type:MinorLast Reviewed:9/20/2005
Keywords:kbfix kbBug kbpending KB283844