比如数据中是select * from product where id=@id,
一旦参数有值,比如ID我输入100,那么就显示ID=100的产品(select * from product where ID=100)
如果默认值设为null或者我不给参数值,点查询报表时我想显示所有的产品(select * from product),应该怎么办?
...全文
2709打赏收藏
SSRS 有参数设置但是默认值要查询所有
比如数据中是select * from product where id=@id, 一旦参数有值,比如ID我输入100,那么就显示ID=100的产品(select * from product where ID=100) 如果默认值设为null或者我不给参数值,点查询报表时我想显示所有的产品(select * from product),应该怎么办?
我用的是SQL Server 2005;
1:
以下有效果,可以使用,但不是我的最佳选择;
IF(@Class_01='')
BEGIN
select itemcode,Class_01 from items
END
ELSE
BEGIN
select itemcode,Class_01 from items where Class_01=(@Class_01)
END
2:
你可以设置成多值参数啊,这样就有一个选择ALL的选项,没有找到阿,不知道怎么设置