I'm moving data that is currently been stored as a int to DateTimeOffset.

Example here is the starting value 1341190841 and when I use this query :

dateadd  (s,Call.StartTime, '1970-01-01') AS StartTimeDate

It returns this value 2012-07-02 01:00:41.000 which is correct. However I'm using SSIS to move data from one db to another and when the data is in the new table the StartTimeDate now looks like this 2012-07-02 01:00:41.0000000 +01:00.

Anyone got any idea how to remove the +01:00? I want to keep the time as it is in the first query.

有帮助吗?

解决方案

I wasn't able to reproduce that behaviour (even with two SQL Servers in different timezones), so this may not be exactly what you want, but you can "fix" the TZ offset (the "+01:00") after copying the data by updating the StartTimeDate column with the function ToDateTimeOffset like this:

UPDATE the_table SET StartTimeDate = TODATETIMEOFFSET(StartTimeDate, 0)

That will leave the date and time untouched while adjusting the offset to the specified one (0 since you want it to "adjust" the TZ from +1 to 0).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top