Datetime field overflow error
From: JohnD (john_nospam_at_tech-testing.com)
Date: 02/02/05
- Next message: Willem Semmelink via SQLMonster.com: "Programmatically create DSN usind SQL Server Authentication"
- Previous message: Hamelech Al Hakol: "how to use datetime range in prepare statement"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 02 Feb 2005 01:45:30 GMT
Hello,
I'm using SQL Server 2000 with ODBC and am having difficulty binding the
appropriate type for use with a datetime column in the database. I have
the requirement that I need to have the milliseconds available to my code.
I've reduced my error to this overly simplified testcase:
The column in the database is defined as a "datetime 8".
/* Code ... */
TIMESTAMP_STRUCT data;
data.year = 1992;
data.month = 8;
data.day = 12;
data.hour = 7;
data.minute = 9;
data.second = 51;
data.fraction = 500;
SQLINTEGER ind = 0;
SQLRETURN rc = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT,
SQL_C_TYPE_TIMESTAMP,
SQL_TYPE_TIMESTAMP,
(SQLUINTEGER)sizeof(TIMESTAMP_STRUCT),
0,
(SQLPOINTER)&data,
sizeof(TIMESTAMP_STRUCT),
(SQLINTEGER*)&ind);
/* End Code ... */
Calling SQLExecute returns the 'Datetime field overflow' error.
I know I'm not fully understanding something, but I cannot seem to find
an appropriate explanation for where I am going wrong.
Any assistance is greatly appreciated.
Thanks,
John
- Next message: Willem Semmelink via SQLMonster.com: "Programmatically create DSN usind SQL Server Authentication"
- Previous message: Hamelech Al Hakol: "how to use datetime range in prepare statement"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|