SSIS - datetime manipulation

  • Hi you all.

    I have this task that I'm working on right now, which is to load flat file into an oracle table. I'm using SSIS to do the task.

    My issue is the datetime column. The data is in eastern time and I want to convert it into either pacific or mountain time depending on the store number.

    this is what I mean: If store_# is 100-400 then convert the time into pacific time

    store_# 401-600 then convert time into mountain time

    It is possible to do this in derived column? Please help. Thanks

  • Yes, but you'll end up doing it in a pair of derived structures because I can't remember offhand if you can embed an if-switch into the DATEADD function.

    First, derive the column to a negative x numeric to pass to the next structure, which will dateadd( "h", <newcolumn>, <existingDateTime>)

    That'll remove your hours. From there, format as needed to make Oracle happy.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Something like this?

    Storeno >= 100 && Storeno <= 400 ? DateAdd("hh",ABS(DateDiff("hh", GetDate(), GetUTCDate()) - 5), DateAdd("mm", -7.00 * 60, GetUTCDate())) : DateAdd("hh",ABS(DateDiff("hh", GetDate(), GetUTCDate()) - 5), DateAdd("mm", -8.00 * 60, GetUTCDate()

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply