I am facing a problem while compare time with given time..
I am explaining this in detail.
please go through this.And please help me..
I have one table that contains two column those contains a interger value
1- StartTime as int
2-EndTime as int
Now i have to compare hour value from current time with these times.
I am Executing the query if hour value of Current time is greater than starttime and hour value of Current time is less than Endtime IN 24HOURS FORMAT.
Now the issue is.
If StartTime = 19 and
Endtime = 7(morning)
If Current hour value returns 20
then 20 > 19 its true but 20<7 this value getting false....
20 is coming between evening 7 o'clock and morning 7 o'clock...but this query is getting false exception...
Please help me on this.....
I wll be very very highly obliged to u all.....

Shankar MPosted May 17, 2013, 6:30 AM
Can you make it little more clear. What you trying to compare with Current Time ?
Two Date Values are needed to compare,
SELECT DATEDIFF(HOUR,GETDATE()-2,GETDATE()) to get the required difference in hours.
and the resultant values only can be compared with the Integer values what you are trying to do ?
Thanks, Shankar M