Amazon RDS-是否有变通办法来更改SQL Server中的数据库时区? [英] Amazon RDS - are there workarounds to change a database time zone in SQL Server?

查看:101
本文介绍了Amazon RDS-是否有变通办法来更改SQL Server中的数据库时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亚马逊最近宣布了由于Microsoft SQL Server 2012仍不支持此功能,是否有任何变通办法来获得类似于更改整个数据库时区的功能?

Since this is still not supported for Microsoft SQL Server 2012, are there any workarounds, to obtain functionality similar to changing the whole database time zone?

推荐答案

由于您正在寻求解决方法...

Since you're asking for workarounds...

我们基本上完全不考虑服务器时间/数据库时区,而完全不使用UTC.例如,所有"DateCreated"列的GetUtcDate().由于我们一直致力于该方法,因此我们不会遇到任何问题.

We basically totally disregard server time/database time zone and work entirely off of UTC. GetUtcDate() for instance for all 'DateCreated' columns. Since we've committed to that approach we just don't bump up against any issues.

如果需要将时区与日期数据一起存储,则可以使用DateTimeOffset.

If you need to store the time zone alongside your date data, you can use DateTimeOffset.

一个警告是维护计划将在服务器时间运行.这不是问题,因为我们将所有日历程序中的所有内容都归一化为本地时间(不是UTC也不是服务器时间).

The one caveat is that maintenance plans will be run on server time. This has not been an issue because we normalize everything to local time (which is not UTC and not server time) in any of our calendaring programs.

这篇关于Amazon RDS-是否有变通办法来更改SQL Server中的数据库时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆