Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

The timezone provided to builtin function todatetimeoffset is invalid #3

Closed
mikegong opened this issue Apr 15, 2015 · 2 comments
Closed
Labels

Comments

@mikegong
Copy link

Got above error when using function Tzdb.UtcToLocal. This issue was caused by a bug of TODATETIMEOFFSET of SQL Server, https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6c38a5cd-8b18-40b6-a5cb-56c45abdc2fd/todatetimeoffset-fails-only-when-reading-smallint-offset-value-out-of-a-table?forum=transactsql.

This problem can be resolved by changing OffsetMinutes from smallint to int.

@mattjohnsonpint
Copy link
Owner

Very interesting! May I ask what version (and service pack) of SQL Server you are using?

@mikegong
Copy link
Author

I tested it on SQL Server 2008 R2 RTM.

BTW, I did not change the data type of OffsetMinites in tables, just changed Declare in function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants