I believe ODBC will do type conversions for you. If not, use sscanf. All sqlite data is stored as strings, I believe, anyway, so there's lots of type conversion going whether it's explicit or not.

Representing dates as floating point numbers can be tricky because of subtle rounding issues, especially when you're dealing with DST issues, btw. You're better off dealing with them as Julian strings.


Rob Richardson wrote:
Greetings!

I am trying to talk to a small SQLite database through ADO and an ODBC
driver.  I want to convert a date to a Julian day before using the date
in a query of a table that could have over a million records.  In
SQliteSpy, the query "SELECT julianday('2007-06-05 12:34:56',
'localtime') AS dateNumber" gives me a floating-point number.  But in
ODBC, I use that query to create a recordset and examine the first value
in the recordset, I see that it is a variant of type VT_BSTR containing
"2345678.9123" (or whatever), and I have to use strtod() to convert it
to the number I want.  Is there a way to write the query to ensure that
it will give me a number instead of a string?

RobR

P.S.  Since I am going to turn around and use the value in another
query, I think I actually do want it in a string, but I'd still like to
know the answer for future reference.




-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to