计算报告中的日期与服务器中的日期的差异
我想计算我们系统生成的报告中两个日期之间的差异。 日期作为 sdCreateDate 存储在系统中,但我似乎无法使用 SELECT DateDiff(d,'sdCreateDate','GetDate()')
以显示差异。
I would like to calculate the difference between 2 dates from a report generated in our system.
The date is stored in the system as sdCreateDate, but I can't seem to useSELECT DateDiff(d,'sdCreateDate','GetDate()')
to get the difference displayed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误出在你的参数上。您不能在
sdCreateDate
和getdate()
上添加单引号。您需要字段名称和函数调用,而不是字符串文字。DATEDIFF() MSDN 参考
The error was with your parameters. You can't put single quotes on
sdCreateDate
andgetdate()
. Instead of string literals, you need to have the field name and the function call.DATEDIFF() MSDN Reference