Export (0) Print
Expand All

Mapping date or time Data

SQL Server 2000

Because C does not have a date or time data type, Microsoft® SQL Server™ 2000 date or time columns are converted to characters by using the SQL Server default date format, for example:

mm dd yyyy hh:mm:ss[am | pm]

You can send dates to SQL Server from C character fields by using any of the character date formats accepted by SQL Server. For a date without a time, use an 11-byte receiving field. If data is truncated, the SQLWARN3 field of the SQLCA data structure is set. For other formats, use the Transact-SQL CONVERT statement. For example, to convert a time without a date, use a statement similar to this:

SELECT CONVERT(char, date, 8) FROM sales

When you attempt to put a fixed-length data type into a buffer that is too small for it, an error occurs and no data is copied.

© 2014 Microsoft