请教一条存储过程
create proc SJZ_WMS_JC
AS
begin
declare @a DATETIME,
set @a=dateadd(day,0,datediff(day,0,getdate()))
select 开始时间=dateadd(week,-1,@a),结束时间=dateadd(ss,-1,@a)
/*领货记录*/
SELECT 站点=dbo.uf_GetStationName(station_id),
领货总数=COUNT(trans_id)
FROM yw_transinfor
WHERE input_date between dateadd(week,-1,@a) and dateadd(ss,-1,@a)
AND station_id IN('XZ82','XZ85','XZ36','XZ55','XZ61','XZ62','XZ66','JP01','XZ67','XZ68','XZ74','XZ81','XZ83','XZ84','XZ93'
)
GROUP BY station_id
ORDER BY station_id ASC
create proc SJZ_WMS_JC
@name varchar(20) --参数:传递姓名
AS
begin
declare @a DATETIME
set @a=dateadd(day,0,datediff(day,0,getdate()))
select 开始时间=dateadd(week,-1,@a),结束时间=dateadd(ss,-1,@a)
/*领货记录*/
SELECT 站点=dbo.uf_GetStationName(station_id),
领货总数=COUNT(trans_id)
FROM yw_transinfor
WHERE input_date between dateadd(week,-1,@a) and dateadd(ss,-1,@a)
AND station_id IN('XZ82','XZ85','XZ36','XZ55','XZ61','XZ62','XZ66',
'JP01','XZ67','XZ68','XZ74','XZ81','XZ83','XZ84','XZ93')
and name=case when ISNULL(@name,'')='' then name else @name end --这里加上传递的参数条件
GROUP BY station_id
ORDER BY station_id ASC
end