I have a table which is populated with production data from our shop floor. Part of what I'm trying to do is get all records from yesterday so we can output what has gone on the day before.
I have the following procedure:
CREATE PROCEDURE [dbo].[sGetRecords]
MyTable.ProductionDate >= @DateFrom
However when I call this no records are returned for the previous day (format: 2012-04-10 12:24:13.000), the only way I can get records is if I change it to <= @DateFrom but this returns everything.
I am passing in the date paramter as: 2012-04-10 00:00:00
I have even tried doing a BETWEEN the date parameter and the result of GetDate() however this also brings back nothing.
I'm probably missing something completely obvious, but I've been looking at this for a while now.