Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Rule for host-specific datetime use #320

Open
lowlydba opened this issue Dec 2, 2022 · 0 comments
Open

Request: Rule for host-specific datetime use #320

lowlydba opened this issue Dec 2, 2022 · 0 comments

Comments

@lowlydba
Copy link
Contributor

lowlydba commented Dec 2, 2022

A rule that checks for GETDATE(), SYSDATETIME(), etc. usage that is dependent on the OS's settings for time zones. Best practice would be to utilize strict UTC (SYSUTCDATETIME(), etc.) and convert from there (inline or in client) as needed. This avoids issues from changes made outside of the SQL Server instance and follows broad best practice wisdom to store/use UTC wherever possible.

sys.time_zone_info can help greatly with this best practice approach and is available on 2016+. The only version in current support without it is 2014 (until 2024), so this best practice approach should be feasible for most MS supported installs.

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

No branches or pull requests

2 participants