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

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

问题描述

亚马逊最近宣布 支持 Oracle RDS 中的时区更改.

由于 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.GetUtcDate() 例如对于所有DateCreated"列.由于我们已经致力于采用这种方法,因此我们不会遇到任何问题.

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天全站免登陆