I need to count the total days between the date ranges specified in a given year.
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