I had this MySQL code
DELETE FROM UserError WHERE UNIX_TIMESTAMP() - UNIX_TIMESTAMP(date) > 86400
What is equivalent to this MySQL code in SQL Server?
You can use lateiff
DELETE FROM UserError WHERE Datediff(s, [date], getdate()) > 86400
You can use DateDiff for this. It looks like this:
DateDiff(datePart,startDate,endDate)
DATEDIFF ( ss , startdate , enddate )
Try the following:
SELECT DATEDIFF(second, '2005-12-31 23:59:59.9999999', '2006-01-01 00:00:00.0000000'); --Syntax DATEDIFF ( datepart , startdate , enddate )