Data Conversion in SSIS

2019-03-06 05:58发布

问题:

I posted one proble yesterday related to data conversion. Now i am rephraising the problem as below.

I have one Text fle where i have date and Time as string. So i need to read that strin (Date + Time) And onvert that in double

We can see in the example below.

"Date"       "Time"       "Converted Double"
"01/31/2014" "30:00.0" to "41670.3541666667"

Now i have done conversion as below.

"Date G " , "Time G ", Concatinated_Date_Time"

"41670.0000000000","00:00.0", "01/31/2014 00:00.0",

I used followin to convert Date G (DT_NUMERIC,16,10)(DT_DATE)[Date G ]

But when i try to do the same with "Concatinated_Date_Time" It gives me error. I need "Concatinated_Date_Time" in double form (41670.548400000).

Please help me.

Thank you

回答1:

Finally i figured it out!

i followed folowing steps.

  1. Convert string "DATE G" in to DT_DATE
  2. DATEADD("Hh",0, outputfrom step 1)
  3. SUBSTRING("TIME G",1,2) store in one output, SUBSTRING("TIME G",3,2) store in one output, SUBSTRING("TIME G",5,3) store in one output

  4. ADD all using DATEADD() and type cast the output to DT_DATE as its output is DT_DBTIMESTAMP which can not be converted to DT_Numeric directlly.

  5. Type Cast to (DT_NUMERIC) output from step 4

Thanks all

Plese let me know if its not explained well.

Thank you all



标签: ssis