[英]How to filter SQL query by using SSRS Yes or No Parameter
How to pass Yes or No parameter to SQL Query in SSRS. 如何将是或否参数传递给SSRS中的SQL查询。 I have set @MyParam Values to 1 and 0. If parameter "Yes" should include the result with types "Direct" with others.
我已将@MyParam值设置为1和0。如果参数“是”应与其他类型一起包含“直接”类型的结果。 If "No" Then result should be without "Direct" with others.
如果为“否”,则结果应与其他人不存在“直接”关系。
Help would be immensely appreciated as usual! 像往常一样,将不胜感激帮助! :)
:)
My Query: 我的查询:
SELECT EQ_WO_ID, EQ_WO_ID, job_type FROM EQ
WHERE ((@MyParam = 1 and job_type='Direct') or (@MyParam = 0 and job_type not null))
The logic you describe is: 您描述的逻辑是:
WHERE ((@MyParam = 1) or
(@MyParam = 0 and job_type <> 'Direct')
)
If job_type
can be NULL
, you need to take that into account for the 0
condition. 如果
job_type
可以为NULL
,那么您需要考虑0
条件。
Just another option. 只是另一个选择。 (my read is contains DIRECT or not).
(我的读物是否包含DIRECT)。
MyParam can be a BIT or INT MyParam可以是BIT或INT
....
Where sign(patindex('%Direct%',job_type))=@MyParam
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.