im using the below function to get network days between the submission date and the day i run the report; at the same time i am using a date parameter in my SSRS to get the tickets between these dates , my problem is i need the end date of the network days to be the end date of my date parameter, i am not sure how to link them together somehow , specially that this function is on my SQL and the date parameter is on my SSRS
alter function [dbo].[days_diff](
@date1 datetime
,@date2 datetime
)
returns int
as
begin
declare @i int;
declare @count int;
declare @diff int;
set @diff = datediff(d,@date1,@date2);
set @i = 0;
set @count = 0;
while(@i < @diff)
begin
select @count = @count + 1
where datename(dw,dateadd(d,@i,@date1)) not in('Saturday'
,'Sunday'
);
set @i = @i + 1;
end;
return @count;
end;