-
Picking all times on a certain day
I am having trouble with this query:
Declare @day datetime
Set @day = getdate()
Declare @day_end datetime
Set @day_end = DateAdd(second, -1,DateAdd(hour, 24, @day))
Select rowid, Substring(Convert(varchar(20), date_time_slot), 14, 6) As timeslot, available From tbl_thresholds Where queue = @queue And date_time_slot between @day And @day_end
The date_time_slot is a datetime field. If I take out the between statement I get data, but with it in I get nothing.
Any ideas why?
-
There must not be any data values in date_time_slot that are between @day and @day_end.
-
Yeah, I just found the problem. The person who created the table when populating the date_time_slot field accidentally set the year to 2002 instead of 2005. Thanks for the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|