存储过程返回一条记录 你好 我写了一个存储过程,让返回给定名字的人的信息. 如何写一个传出参数将这个记录返回来呢? [解决办法] @参数 类型 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