我有这个MySQL代码
DELETE FROM UserError WHERE UNIX_TIMESTAMP() - UNIX_TIMESTAMP(date) > 86400
SQL Server中的这个MySQL代码等同于什么?
答案 0 :(得分:15)
你可以使用datediff
DELETE FROM UserError WHERE
Datediff(s, [date], getdate()) > 86400
答案 1 :(得分:2)
试试这个:
SELECT DATEDIFF(second, '2005-12-31 23:59:59.9999999', '2006-01-01 00:00:00.0000000');
--Syntax
DATEDIFF ( datepart , startdate , enddate )
答案 2 :(得分:1)
您可以使用DateDiff。它看起来像这样:
DateDiff(datePart,startDate,endDate)
答案 3 :(得分:0)
DATEDIFF ( ss , startdate , enddate )