SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


count of non-holiday weekdays


count of non-holiday weekdays

Author
Message
kiran.rajenimbalkar
kiran.rajenimbalkar
Old Hand
Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)

Group: General Forum Members
Points: 397 Visits: 331
Hi Expert,

I want to populate records in my one of the column as per below,

count of non-holidays i.e. weekdays from initial 'Submitted' status to 'Paid' status.


CRETE TABLE
--------------------------------

create table bbc 
(id int,st_date date,end_date date,status_id nvarchar(200))



INSERT INTO TABLE
---------------------------
insert into bbc values (5,'2012-10-08','2012-10-08','Paid')
insert into bbc values (4,'2012-10-06','2012-10-06','Approved: Ready for Pay')
insert into bbc values (3,'2012-10-03','2012-10-03','Submitted')
insert into bbc values (2,'2012-10-01','2012-10-01','Authorizd Required')
insert into bbc values (1,'2012-10-01','2012-10-01','Draft')
insert into bbc values (5,'2012-09-05','2012-09-06','Paid')
insert into bbc values (4,'2012-09-05','2012-09-05','Approved: Ready for Pay')
insert into bbc values (3,'2012-08-30','2012-08-30','Submitted')
insert into bbc values (2,'2012-08-29','2012-08-29','Authorizd Required')
insert into bbc values (1,'2012-08-29','2012-08-29','Draft')

go



So please how to do this?

Regards,
Kiran
Rob Taylor
Rob Taylor
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3654 Visits: 1616
One way to do this is to create a Calendar or Date table.

Take a look at: http://weblogs.sqlteam.com/dang/archive/2010/07/19/calendar-table-and-datetime-functions.aspx

HTH,
Rob
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search