I'm trying to create a report that gets records from a SQL Server database where the delivery date is today.
I've tried
select * from (tablename)
where delivery_date = getdate()
Although that didn't give me any errors, it didn't give me any records either.
I'm assuming it is because all dates are like:
2016-03-15 00:00:00.000
Perhaps, I need to truncate the date to remove the time-stamp and then try?
getdate()
todate
- this will cut off time. Or use date range ifdelivery_date
stored may contain time too (if it is so I'd suggest to use this approach instead of casting both sides todate
). – Overflight