关于Repert Servcies下有判断时的参数问题
我现在如果有一个报表,命令类型是Text,配置了几个报表参数,如果是以下这个形式就执行成功:
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