I've got events in my database. Some start at a certain time, so we save the time. Others do not specify a time, so only the date is saved. All of these entries in the db are datetimes.
In my application, if the user wants events for just one day, that date (ex: '10/17/2005') is passed in to my stored procedure. Then my code looks something like this:
I'm asking for dates in front or after because I still want to catch those events that are an ongoing event that are still taking place on the requested date.
Problem is, if a date is scheduled for '10/17/2005 9:00:00 AM' and the user requests all events for '10/17/2005', the above entry does not show up because it has no time value and is thought to be midnight.
Since I still want to include the range-type events... how can I get around this in SQL? Any thoughts?
Thanks so much!
In my application, if the user wants events for just one day, that date (ex: '10/17/2005') is passed in to my stored procedure. Then my code looks something like this:
Code:
AND EventStartDateTime <= ' + @RequestedDate + ' AND EventEndDateTime >= ' + @RequestedDate
I'm asking for dates in front or after because I still want to catch those events that are an ongoing event that are still taking place on the requested date.
Problem is, if a date is scheduled for '10/17/2005 9:00:00 AM' and the user requests all events for '10/17/2005', the above entry does not show up because it has no time value and is thought to be midnight.
Since I still want to include the range-type events... how can I get around this in SQL? Any thoughts?
Thanks so much!