How do I make wildcards work in a like operator in SQL Server reporting services?

血红的双手。 提交于 2019-11-30 01:45:47

问题


I have added a filter expression using the like operator. What do I put in the value field? my parameter is named @test and I'd like the filter to function as a like %@test% would in SQL. I want it to act like %@test% so I can pass '' to get all values for the query.


回答1:


I got this to work by adding a filter expression with a like operator and setting the value to this:

="*" + Parameters!Roles.Value + "*"

To get all values I pass ''.




回答2:


You could also simply use string concatenation in the original Dataset that you want to filter on. You can access the parameters in the same manner as SQL:

WHERE fieldname LIKE '%' + @test + '%'

You can then link the report parameter @test to the @test in the dataset via the parameters option on Dataset Properties.




回答3:


You should use this Query in the DATA SECCTION of the REPORT WIZARD.

SELECT * FROM HR.JOBS WHERE JOB_TITLE LIKE  :JOB_TITLE | |'%'



回答4:


you could use this simple query.

WHERE fieldname LIKE CONCAT('%',@test,'%')

Used CONCAT



来源:https://stackoverflow.com/questions/4898358/how-do-i-make-wildcards-work-in-a-like-operator-in-sql-server-reporting-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!