SSIS script - manupilate field (time)
Yes, you can use script component, and write .net code using TimeZoneInfo like this:
http://stackoverflow.com/questions/246498/creating-a-datetime-in-a-specific-time-zone-in-c-sharp-fx-3-5http://www.rad.pasfu.com
August 28th, 2012 5:42pm
Hi
I tried this method below but I got error messages.
. Contain an invalid token, incomplete token or an invalid element.
. It might not be well formed.
Cannot parse the expression.
. The expression is not valid.
Storeno >= 10 && Storeno <= 50 ? 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()))
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2012 11:38am
Hi you all.
I'm new to SSIS.
I'm doing a bulk load using SSIS. One of the field ( data-type = time), I want to adjust this field data from Eastern Time into Pacific and Mountain Time.
Time depends on the store number.
Ex:
store # 10-50 ( Mountain Time)
60-100(Pacific Time)
the original data is in Eastern Time.
How do I it? Do I use a script task or derived column? Please help, sample work or script would be awesome!
Thanks!
August 31st, 2012 5:23pm
Yes, you can use script component, and write .net code using TimeZoneInfo like this:
http://stackoverflow.com/questions/246498/creating-a-datetime-in-a-specific-time-zone-in-c-sharp-fx-3-5http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2012 5:59pm
Thanks Reza for your quick reply.
August 31st, 2012 6:15pm
Hi,
You can also use Derived column to achieve this by using an expression something like this,
Storeno >= 10 && Storeno <= 50 ? 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()))
You might need some datatype conversion if it does not work.
Regards,
Vinaya
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2012 6:16pm
Hi,
You can also use Derived column to achieve this by using an expression something like this,
Storeno >= 10 && Storeno <= 50 ? 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()))
You might need some datatype conversion if it does not work.
Regards,
Vinaya
This is quicker method, BUT This method will not consider the Day Light Saving, http://www.rad.pasfu.com
August 31st, 2012 6:22pm