alter procedure test @year varchar(10)
as begin
declare @Acount int
Declare @StartDate varchar(20)
Declare @EndDate Varchar(20)
set @StartDate='2014-08-09'
set @EndDate='2014-08-19'
set @Acount=0
if(((YEAR(@StartDate))=@year)and((YEAR(@EndDate))=@year))
SET @ACOUNT=@ACOUNT+CONVERT(INT,(SELECT
(DATEDIFF(dd, @StartDate, @EndDate) + 1)
-(DATEDIFF(wk, @StartDate, @EndDate) * 2)))
print @StartDate
print @Enddate
print @Acount
End
Here i am getting the @Acount as 7 but the Difference between them is 11. I hope so the saturdays and sundays are excluding from them .
But i need the total All days .How to do .
Naveen KumarPosted Aug 8, 2014, 7:38 AM
Now it works fine and showing the count Including all weekends