February 21, 2008 at 4:43 am
Hello
This code returns me to the all workdays and holidays in a year:
create table Agenda
(
dt smalldatetime primary key clustered,
WeekDay as convert(bit, case when datepart(dw, dt) in (1) then 0 else 1 end),
WorkDay bit default 1
)
go
declare @dt smalldatetime;
set @dt = '20080101';
while @dt <= '20081231'
begin
insert Agenda(dt) select @dt;
end
update Agenda
set WorkDay = 0 where WeekDay = 0;
update Agenda
set WorkDay = 0 where WeekDay = 1
and dt in
--manually arranged special holidays:
(
'20080101',
'20080423',
'20080519',
'20080929',
'20080830',
'20080215',
'20080216',
'20080217'
)
How can this returns ONLY holidays (each sunday and manually arranged holidays) and NOT workdays(i mean not show workdays in table) and gives me a difference between sundays and special holidays (Because I want to do a special treatment in special holidays) in the SAME column? Every change in the code can be acceptable 🙂 Thanks...
February 21, 2008 at 4:54 am
It's difficult to understand what you're trying to do. Please will you post a sample of the results you're getting, and then show how they should look?
John
February 21, 2008 at 5:12 am
I understand... if "every code change can be acceptable", then consider implementing that which is found at the following URL:
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply