Stored procedure to get saturdays and sundays between two dates...

u can get the saturdays and sundays between two dates using this procedure...run this in sql query analyser and use it in ur c#application...



CREATE procedure UDSP_Holidays (@fromdate smalldatetime, @todate smalldatetime)
as
Begin
DECLARE @lsql varchar(100)
CREATE TABLE #TEMP (HDATE SMALLDATETIME)
WHILE (@fromdate <= @todate)
BEGIN
IF( DATEPART(DW,@fromdate) = 1 OR DATEPART(DW,@fromdate) = 7)
BEGIN
Insert into #TEMP values(@fromdate)
END
set @fromdate=@fromdate+1
END
select day(HDATE) as Day from #TEMP order by day
End



Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: