Using this sample data
create table #badway
(
id integer identity(1,1),
mytime varchar(8)
)
insert into #badway (mytime) values
('1:00 AM'),
('2:00 AM'),
('3:00 AM'),
('4:00 AM'),
('7:00 AM'),
('1:00 PM'),
('2:00 PM'),
('3:00 PM')
Then this query fits your criteria
select id, convert(time, mytime) from #badway
where convert(time, mytime) between '07:00:00' and '23:59:00'
Note the use of the 24hr clock.
As I said in my comment, you should use
time
column types to store times, not
varchar
, then there would be no need for the
convert