------解决方案-------------------- @参数 类型 output
as
set @参数='值' ------解决方案-------------------- --完整示例:
create PROCEDURE judge_sunday @count int output
as
begin
declare @startDate datetime,@endDate datetime,@numDays int--,@count int
set @startDate = DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
set @endDate = DATEADD(day,-1,DATEADD(mm,1,@startDate))
set @numDays = datediff(day, @startDate, @endDate) + 1;
With NumDays as
(
select top(@numDays) row_number() over(order by (select 0)) as n from sys.objects
)
select @count=count(*) from NumDays
where DATEPART(WEEKDAY,convert(varchar(10), dateadd(day, NumDays.n - 1, @startDate), 120))=1
return @count
end