Should be simple. I'm writing a report to find employees by last name.
I want the user to key in at least a few characters of the last name and the report will search for all last names that are like that.
I know in TSQL it would go:
Last_name like 'Jones%'
But how do I set up a parameter in Reporting Services
I've tried:
last_name like =@.name%
Any ideas?
Thanks,
Jim
Any ideas? Can the Keyword "Like" be used to find similar occurences of a user entered parameter...|||Within the dataset query you can declare a variable that references the parameter with the text then append the necessary % to the end. So the reference would look something like...DECLARE @.some_variable NVARCHAR(40)
SET @.some_variable = @.parameter_field_text + '%'
You can then use this...
SELECT *
FROM some_view
WHERE NameField LIKE @.some_variable|||
You would probably need to use dynamic sql and expression.
="Select * from table1 where last_name like '" + @.name + "%'"
Or use a stored procedure and perform the like statement within it.
cheers,
Andrew
No comments:
Post a Comment