May 4, 2009 at 12:33 pm
My dataset
SELECT description
FROM tab1
where description = '%@Description%'
also tried
SELECT description
FROM tab1
where description = '%" + @Description + '%'
also tried
SELECT description
FROM tab1
where description = '*@Description*'
I am trying to create a report with a filter on a text field for which I am using like operator . The user will pass a parameter based on the column values(description column) for this like operator.
But when I run this query it does not result any results.
Thanks
May 4, 2009 at 12:48 pm
Have you tried this:
SELECT description
FROM tab1
where description = '''%' + @Description + '%'''
Please note, that is three single quotes at the start and end.
May 4, 2009 at 1:22 pm
Lynn Pettis (5/4/2009)
Have you tried this:
SELECT description
FROM tab1
where description = '''%' + @Description + '%'''
Please note, that is three single quotes at the start and end.
You probably need to change the query from an EQUAL query to an LIKE query (the failure wasn't caused by the single quotes):
SELECT description
FROM tab1
where description LIKE '%' + @Description + '%'
May 4, 2009 at 1:25 pm
lmu92 (5/4/2009)
Lynn Pettis (5/4/2009)
Have you tried this:
SELECT description
FROM tab1
where description = '''%' + @Description + '%'''
Please note, that is three single quotes at the start and end.
You probably need to change the query from an EQUAL query to an LIKE query (the failure wasn't caused by the single quotes):
SELECT description
FROM tab1
where description LIKE '%' + @Description + '%'
Good catch, didn't see the forest for the trees.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply