I’m trying to run this query that check if the current time not between 19:00:00 and 02:00:00 (next day)
if (select convert(nvarchar (8), getdate(), 114)) not between '19:00:00' and '02:00:00'
begin
print 'a'
end
It’s not working when the time is after 00:00:00
Why?
Thanks
>Solution :
IF NOT
(
(select convert(nvarchar (8),getdate(),114)) between '00:00:00' and '02:00:00'
OR
(select convert(nvarchar (8),getdate(),114)) between '19:00:00' and '23:59:59.999'
)
print 'a'