all groups > sql server reporting services > december 2005 >
You're in the

sql server reporting services

group:

Using a Like Query


Using a Like Query john wright
12/22/2005 11:55:41 AM
sql server reporting services:
I want to provide a parameter for my users to look up an item using a
description field. The database is set up with a description field for each
item. I have set up the parameter for this description field, now I want it
to act as a like query and search for all similiar matches. How is this
done?

Similiar to the following query

SELECT
PartID, Part, QTY, Description
FROM
TableX
WHERE
Description like '%[parameter value]%'

Thanks.

john

Re: Using a Like Query Oleg Yevteyev
12/22/2005 3:46:21 PM
Select generic query editor and use something like
=string.Format("SELECT PartID, Part, QTY, Description FROM TableX WHERE
Description like '%{0}%'",Parameters!YoursParameter.Value)
as a query


[quoted text, click to view]

RE: Using a Like Query Wayne Snyder
12/26/2005 4:55:04 AM
Oleg shows you how to do this in a filter... I prefer to do it in a query,
which seems to be what you were asking...

Create a data set with the following query

SELECT
PartID, Part, QTY, Description
FROM
TableX
WHERE
Description like @Description

THen test the report... BIDs will automatically add a parameter called
Description and hook it to the query... But your users MUST add the wild card
characters themselves.. THis is most flexible because they can search for an
exact match OR use wildcards - but they must be trained ..IF you always want
to add the wildcard stuff... try

SELECT
PartID, Part, QTY, Description
FROM
TableX
WHERE
Description like '%' + @Description + '%'


Good luck and have fun!



--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC

I support the Professional Association for SQL Server ( PASS) and it''s
community of SQL Professionals.


[quoted text, click to view]
Re: Using a Like Query Bruce L-C [MVP]
12/26/2005 9:47:23 AM
Or instead of the users putting in a wild card do this:

SELECT
PartID, Part, QTY, Description
FROM
TableX
WHERE
Description like @Description + '%'


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

AddThis Social Bookmark Button