If I had a table in ACCESS with a date/time column and I wanted all records within the last 24 hours I could do this sort of thing:
Quote:
SELECT * FROM Table1 where datediff('n',Field1,now) < 1440
How do I do this in SQL Server?
Thanks
Printable View
If I had a table in ACCESS with a date/time column and I wanted all records within the last 24 hours I could do this sort of thing:
Quote:
SELECT * FROM Table1 where datediff('n',Field1,now) < 1440
How do I do this in SQL Server?
Thanks
Give this a whirl!
Code:SELECT * FROM Table1 where datediff(hour,Field1,GetDate()) <= 24
Thanks
That's perfect!