I think you are making it more difficult than it has to be... If you want to consider both the date and time you have stored for each shift, your query should look something like this: select intShiftId from tblShift where getdate() BETWEEN dtStartTime AND dtEndTime
Or if you only care about the time portion of dtStartTime AND dtEndTime (which seems to be the case based on the SELECT statement you provided) then I believe something like this would work: select intShiftId from tblShift where CONVERT(DATETIME, CONVERT(varchar, getdate(), 108), 108) BETWEEN CONVERT(datetime, CONVERT(varchar, dtStartTime, 108), 108) AND CONVERT(datetime, CONVERT(varchar, dtEndTime, 108), 108)
Edited by - izaltsman on 02/20/2002 09:40:37