How to check if a datetime field equals current date in SQL Server Transact SQL

Had to write a SQL Server query to check if a date is the current day. After some searching I found a good way of doing it here:

SELECT * FROM table WHERE DATEDIFF(day, StartDate, GETDATE()) = 0

No comments:

Post a Comment