As per my requirement there are two columns in my db called from_time and to_time both are time data type. In the store procedure i am comparing both these timings. I am trying to compare both like following
while (from_time < to_time)
the above statement is not comparing...
Any help is highly appreciatable...
Answer by Kev Riley ·
this compares fine on my SQL 2008 instance, so how are you actually doing the compare?
declare @from_time time declare @to_time time set @from_time = '08:30' set @to_time = '03:00' if @from_time < @to_time Print 'from time is earlier' if @from_time > @to_time Print 'from time is later'