Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ppx
Starting Member
3 Posts |
Posted - 2009-08-04 : 04:49:48
|
Hi!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! |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-04 : 05:00:18
|
BCP is a command line application, not a T-SQL command.Open a command window in you OS, and then run "BCP ... " with all the options you want. N 56°04'39.26"E 12°55'05.63" |
|
|
ppx
Starting Member
3 Posts |
Posted - 2009-08-04 : 05:09:12
|
please referhttp://msdn.microsoft.com/en-us/library/ms130922.aspxan extract:The SQL Server-specific bulk-copy API extension of the SQL Server Native Client ODBC driver allows client applications to rapidly add data rows to, or extract data rows from, a SQL Server table.and these are the functions that I'm trying to use.please let me know if anyone managed a way to manipulate the DBDATETIME.thanks!quote: Originally posted by Peso BCP is a command line application, not a T-SQL command.
|
|
|
ppx
Starting Member
3 Posts |
Posted - 2009-08-05 : 04:25:44
|
never mind... dividing dttime by 3.33333.. seems to give a very close approximation. |
|
|
|
|
|
|
|