Any advice on whay the following queery fails to select records where the date column SEGStart = 01/08/2012. If I change the lower date range value from '28/07/2012' to '01/08/2012' then it works?
Select * From Import_ACD_Call_Details Where ANSLogin = 25108 AND (Convert(varchar(10), SEGStart, 103) >= '28/07/2012' AND Convert(varchar(10), SEGStart, 103) <= '03/08/2012') Order By CallID, Segment
Okay, I am running this query in SSIS Exexute SQL Task and the date field will be passed as a datetime variable. This is why I was using convert. How would this best be completed in SSIS?
you can pass them as varchar but make sure you use >= and < logic to ensure you've whole interval covered as in my example @ 09/17/2012 : 13:09:10 above. there also i'm passing values as varchar only (note ' around values)
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/