DATEADD - 我如何进行比较
我试图检查第二次尝试(你可以想象任何类似密码尝试、下载尝试等)是否是在从尝试1时间(@start< /代码>)。当其他日期时间比较与关系运算符一起使用时,为什么会报告语法错误
declare @start datetime
declare @window INT
select @start = GETDATE(),@window = 10
select CAST((DATEADD(MINUTE,@window,@start) <= @start) as BIT)
预期输出类似于 0,但我得到“<”附近的语法不正确。
I am trying to check if the second attempt(u can imagine anything like password attempt, download attempt etc) is made within a time limit(@window
) starting from attempt1 time(@start
). Why does this report a Syntax error when other datetime comparisons work with relational operators
declare @start datetime
declare @window INT
select @start = GETDATE(),@window = 10
select CAST((DATEADD(MINUTE,@window,@start) <= @start) as BIT)
Expected output was something like 0 but i get Incorrect syntax near '<'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this: