dbTalk Databases Forums  

Dealing with Dates

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


Discuss Dealing with Dates in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kenny Taylor
 
Posts: n/a

Default Dealing with Dates - 10-12-2004 , 02:19 PM






I have data coming from a text file that has dates
incorrect (ex: 04-2-1493) which should be 04-2-1943. The
table it is going into is a datetime field and spits out
an error when it comes to these record (seems to be over
1000 + records). How should I handle that in a DTS
process, should I just make the column it is going into a
varchar(10) or deal with it as it goes in. I definitely
want that record to go in since I am reliant on the other
information in that record and since there are over 1000
records with the same error (typos)?

Thanks

Reply With Quote
  #2  
Old   
ilona
 
Posts: n/a

Default Re: Dealing with Dates - 10-13-2004 , 01:04 PM






I think the best way is to deal with it in your DTS as it goes in.
Set up your transformation for this field as ActiveX Script - type
transformation and write a script that handles this case. You can use
standard VB functions like InStr, CDate to correct the date.

Regards,
Ilona Shulman


"Kenny Taylor" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have data coming from a text file that has dates
incorrect (ex: 04-2-1493) which should be 04-2-1943. The
table it is going into is a datetime field and spits out
an error when it comes to these record (seems to be over
1000 + records). How should I handle that in a DTS
process, should I just make the column it is going into a
varchar(10) or deal with it as it goes in. I definitely
want that record to go in since I am reliant on the other
information in that record and since there are over 1000
records with the same error (typos)?

Thanks



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

Default Re: Dealing with Dates - 10-13-2004 , 01:05 PM



If you make it a text destination then it will load but still be wrong
right?

How about you do something like

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

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.Konesans.com


"Kenny Taylor" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have data coming from a text file that has dates
incorrect (ex: 04-2-1493) which should be 04-2-1943. The
table it is going into is a datetime field and spits out
an error when it comes to these record (seems to be over
1000 + records). How should I handle that in a DTS
process, should I just make the column it is going into a
varchar(10) or deal with it as it goes in. I definitely
want that record to go in since I am reliant on the other
information in that record and since there are over 1000
records with the same error (typos)?

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.