sql server 2008: bcp_sendrow, issue: invalid time format

By : Space
Source: Stackoverflow.com
Question!

I'm having a problem "Invalid time format" when I try to use bcp functions(bcp_sendrow/bind etc.) to insert into a table having a datetime column. so as per googled examples, I populated a DBDATETIME structure, for example: if I wanted to populate 3rd august 2009, exactly 8am localtime, I'd populate the structure members like so:

dtdays=40026(num days since 19000101) and dttime = 28800000 (num millisecs since midnight)

(Also having bound the var. as a SQLDATETIME) if dttime is 7 digits wide(or less), then bcp suceeds(but obviously with a wrong time value (date part is ok) )

how can I sort this out? I've tried datetime2 /time etc. but nothing helped. please help , all advice/ideas most appreciated. (I'm using Sql server 2008, and (ODBC) sql native client 10.0)

thanks!

By : Space


This video can help you solving your question :)
By: admin