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.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Date Format Help

Author  Topic 

jscot
Posting Yak Master

106 Posts

Posted - 2011-02-16 : 21:22:16
I hate source field date like this :- 08312011
04302008
07132005
08312004
08312007
08312001
08312007
08312007
08312007
I am using this expression in derived column:-

(DT_DATE)(SUBSTRING([Copy of Entry Date],1,4) + "-" + SUBSTRING([Copy of Entry Date],5,2) + "-" + SUBSTRING([Copy of Entry Date],7,2))

And I am receiving error. Error is listed below

“[Derived Column [149]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Column" (149)" failed because error code 0xC0049064 occurred, and the error row disposition on "output column "START_DATE_1" (937)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.”

Please guide me where I am wrong.

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2011-02-17 : 04:50:24
The above expression will convert 08312011 to 0831-20-11
You should try for a date format of YYYYMMDD, like 20110831:
(DT_DATE)(SUBSTRING([Copy of Entry Date],5,4)+ SUBSTRING([Copy of Entry Date],1,4))
Go to Top of Page

jscot
Posting Yak Master

106 Posts

Posted - 2011-02-17 : 08:56:26
Yellowbug thanks for prompt reply, I am sorry i forgot to mention, my target field has "datetime" data type.
Let me try to expression and I will give you update? Thanks for your help.

"(DT_DATE)(SUBSTRING([Copy of Entry Date],5,4)+ SUBSTRING([Copy of Entry Date],1,

Go to Top of Page
   

- Advertisement -