If you have a Numbers table (some people call it a Tally table), you can query it using something like:
create table #Numbers (
Number int primary key);
insert into #Numbers (Number)
select top 1000 row_number() over (order by object_id)
from sys.all_objects;
declare @String char(168);
select @String = replicate('0',24) + replicate('9',24) + replicate('0',120)
;with Available (Day, Avail) as
(select (number-1)/24 + 1, substring(@String, number, 1)
from #Numbers
where number between 1 and len(@String))
select distinct Day
from Available
where Avail = 9;
That query would give you the days that have times available.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon