dbTalk Databases Forums  

Text Files & Date Fields

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


Discuss Text Files & Date Fields in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter Newman
 
Posts: n/a

Default Text Files & Date Fields - 01-07-2004 , 04:33 AM






I have a DTS that is reading a txt file. Part of the txt
file is being imported into 1 table using a datapump
task. That part is fine

The second part of the file i read into global varibles
and use a EXECUTESQL Task to inset them to another table.
I wont go into the reasons for this. This part of the
file contains dates ( i.e 01/01/2004' as strings. I need
to import them to the table as smalldate values. What
is thew best way to do this.. 1, should i set the Global
Varable as a date ? or should i use a cast function in
the execute SQL task ?

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Text Files & Date Fields - 01-07-2004 , 04:36 AM






I find this way works for me

Formatting Character Data into Datetime fields
(http://www.sqldts.com/default.aspx?249)

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have a DTS that is reading a txt file. Part of the txt
file is being imported into 1 table using a datapump
task. That part is fine

The second part of the file i read into global varibles
and use a EXECUTESQL Task to inset them to another table.
I wont go into the reasons for this. This part of the
file contains dates ( i.e 01/01/2004' as strings. I need
to import them to the table as smalldate values. What
is thew best way to do this.. 1, should i set the Global
Varable as a date ? or should i use a cast function in
the execute SQL task ?



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.