Extra Zeros exporting datetime data to text -
11-10-2006
, 08:02 AM
I've run into a data transformation issue:
I've written an export DTS package that has two connections: 1. SQL
Server 2000 , 2. Destination Text File.
The Text File is set up in the following manner:
Delimited
File Type: Ansi
Row: {CR}{LF}
Column: Vertical Bar
Text qualifier: none
First row has coumn names.
the SQL table contains one field:
exportDate datetime
This field is populated by a stored procedure with the getdate()
function.
A typical row looks like:
2006-11-09 16:57:15.297
the data pump from SQL to Text file is a simple select * statement.
Here's the problem:
When I open the text file, the date information looks like this:
2006-11-09 16:57:15.297000000
The extra zeros that are added to the milliseconds cause an error
converting from varchar to datetime when I import the data. I have
gotten around this by CAST(SUBSTRING(exportDate,1,23) AS datetime), but
I would like to know WHY it happens in the first place.
Any ideas?
(Related, but unrelated: I've noticed that the same type of export as
described above converts a bit datatype value of 0 to a varchar value
of "False", and the import cannot convert "False" back to 0.)
Thanks! |