dbTalk Databases Forums  

Extra Zeros exporting datetime data to text

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Extra Zeros exporting datetime data to text in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jason.maffetore@gmail.com
 
Posts: n/a

Default 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!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.