关于Reporting Services下有判断时的参数问题

0

if(@TimeType=1)
begin

查询

end

else if (@TimeType = 2)

begin

查询

end

if(@Year is not null and @quarter is not null)
begin
if(@quarter =1)
begin
set @startDate =convert(datetime, @Year+'-1-1')
set @EndDate=convert(datetime, @Year+'-3-31')
end
else if(@quarter =2)
begin
set @startDate =convert(datetime, @Year+'-4-1')
set @EndDate =convert(datetime, @Year+'-6-30')
end
else if(@quarter =3)
begin
set @startDate =convert(datetime, @Year+'-7-1')
set @EndDate =convert(datetime, @Year+'-9-30')
end
else if(@quarter =4)
begin
set @startDate =convert(datetime, @Year+'-10-1')
set @EndDate =convert(datetime, @Year+'-12-31')
end
else if(@quarter =5)
begin
set @startDate =convert(datetime, @Year+'-1-1')
set @EndDate =convert(datetime, @Year+'-6-30')
end
else if(@quarter =6)
begin
set @startDate =convert(datetime, @Year+'-7-1')
set @EndDate =convert(datetime, @Year+'-12-31')
end
else if(@quarter =7)
begin
set @startDate =convert(datetime, @Year+'-1-1')
set @EndDate =convert(datetime, @Year+'-12-31')
end

end

if(@TimeType=1)
begin

查询

end

else if (@TimeType = 2)

begin

查询

end

“本地报表处理期间出错。处理报表时出错。XXX，必须声明标量变量@Year,必须声明标量变量@quarterxxxxxxxx”

0

您需要登录以后才能回答，未注册用户请先注册