I had this MySQL code
DELETE FROM UserError WHERE UNIX_TIMESTAMP() - UNIX_TIMESTAMP(date) > 86400
What is equivalent of this MySQL code in SQL Server?
You can use datediff
DELETE FROM UserError WHERE
Datediff(s, [date], getdate()) > 86400
Try this:
SELECT DATEDIFF(second, '2005-12-31 23:59:59.9999999', '2006-01-01 00:00:00.0000000');
--Syntax
DATEDIFF ( datepart , startdate , enddate )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With