all groups > sql server odbc > november 2003 >
You're in the

sql server odbc

group:

SQL datetime to C tm



SQL datetime to C tm Leon McCalla
11/21/2003 10:29:44 PM
sql server odbc: can I import a datetime field from SQL to a tm structure without going to a
string first?

ODBC mentions timestamps and SQL uses datetime. I'm having difficulty
understanding what I should do to import/export from a C tm structure to an
SQL datetime field and visa versa. right now I have to convert to a text
string as an intermediate solution but I'd like to remove this to clean up
the code.

Leon

Re: SQL datetime to C tm Roger Stoller
11/25/2003 8:58:44 PM
For MS SQL Server, the best thing you can do for now is to convert to and
from strings. That's what I'm doing. You can't use the SQL_xxx_STRUCT's
since there's no way to store just a date or just a time. In addition, the
timestamp type is more of a "row version" which is updated by SQL server
every time the row is updated; and you can only have one timestamp field in
a table. Not sure why MS decided to implement things this way since it
doesn't seem to jive with the ODBC standard that they helped develop.

- Roger

[quoted text, click to view]

AddThis Social Bookmark Button