I'm looking for suggestions and personal experiences with time localizations in TSQL and sql job scheduling (We are using SQL Server 2012).
I came across those situations where I would need more support for timezones and DST support in MS SQL Server:
- Attempt to store autocomputed column for date in different timezone in order to be able to cluster index on this column.
- Being able to also update exisiting table containing datetime2 field in UTC time in order to achieve previous goal (e.g. index table on PST date; without time part)
- Attempt to schedule a sql job that would ran at specific time in different timezone (e.g. to create materialized view containing only data for current PST day).
I searched through web and found those possibilities:
- A Store table with time zones offsets + DST info and calculate the proper localized time with TSQ (= reinventing the wheel requiring maintenance of the table with timezones info)
- B Perform the localization completely in client code and store the result in DB. This option requires custom throw away apps for updating existing data, and also custom scheduled task app replacing the sql jobs functionality.
- C Using CLR stored procedures. I'm yet to investigate this option more in depth.
Are there any other options? Are there any strong pros or cons of any option that would rule such an option or other options out?