Subject RE: [firebird-support] ISC_TIMESTAMP vs. Current Time
Author Alan McDonald
> Hi.
>
> I need to pull two dates from a table and compare them to the current
> time. I keep getting an error that there is an illegal string
> conversion of \"31-MAY-2007\", which is the date in the TIMESTAMP field.

it's illegal because there's no time component to your string.
add a time component, cast it to timestamp, or use DATESTAMP instead.
Alan

>
> Below is a code fragment of what I'm attempting to do...any advice
> would be appreciated....
>
> Kurt.
>
>
> // SET UP THE FIELDS RETURNED BY QUERY....
> SQLDA1->sqlvar[0].sqldata = (char *) Trends.szMAC;
> SQLDA1->sqlvar[0].sqltype = SQL_TEXT;
> SQLDA1->sqlvar[0].sqllen = 32;
>
> SQLDA1->sqlvar[1].sqldata = (char*) &Start;
> SQLDA1->sqlvar[1].sqltype = SQL_TIMESTAMP;
> SQLDA1->sqlvar[1].sqllen = sizeof(ISC_TIMESTAMP);
>
>
> SQLDA1->sqlvar[2].sqldata = (char*) &Stop;
> SQLDA1->sqlvar[2].sqltype = SQL_TIMESTAMP;
> SQLDA1->sqlvar[2].sqllen = sizeof(ISC_TIMESTAMP);
> .
> .
> .
> // THIS STATEMENT ALWAYS FAILS WITH A CONVERSION ERROR...
> while( 0 == isc_dsql_fetch(STAT1, &STMT1, 1, SQLDA1) )
> {
> // COPY THE RESULTS...
> memset( &Trends, 0, sizeof(Trends) );
>
> RightTrim( Trends.szMAC, 32 );
>
> // HERE'S WHERE I NEED TO CONVERT TO STRUCT TM/TDATETIME...
> }
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>