SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS - datetime manipulation


SSIS - datetime manipulation

Author
Message
musclewindows_25
musclewindows_25
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 11
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
Evil Kraig F
Evil Kraig F
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39355 Visits: 7660
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>Wink

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 | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
musclewindows_25
musclewindows_25
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 11
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()
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search