sql-server – 更改Getdate的输出

前端之家收集整理的这篇文章主要介绍了sql-server – 更改Getdate的输出前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
是否有可能欺骗sql Server在GetDate()上返回不同的日期而不实际更改机器日期?
这将是很好的,因为我们有一个包含旧数据的数据库,我正在尝试测试一些使用getdate()的查询.
我可以更改我的机器日期,但这会带来其他应用程序的其他一些问题……
有小费吗?
谢谢!

解决方法

根据 documentation for getdate()

This value is derived from the
operating system of the computer on
which the instance of sql Server is
running.

由于它来自操作系统,我认为你不能单独更改它.

原文链接:https://www.f2er.com/mssql/83901.html

猜你在找的MsSQL相关文章