Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatened Parametes

Status
Not open for further replies.

angjbsca

Programmer
May 26, 2006
30
PR
Hi How I do this:

select * from t1 where f1 like '%joe%'
with parameters
I try this but does not work;
select * from t1 where f1 like '%' || ? || '%'





 
It's not clear to me what you're trying to do. Could you elaborate...
 
Im working with report application and db2 so,
if I send a query with parameters I do that:

select * from t1 where f1 = ? where ? is the param thats query work fine.

but if I use "Like" with wild cards "%" in .net with sql
I do that:

select * from t1 where f1 like + "'%" + ? + "&'"
but in db2 that king of query do not work for me.

 
From within your .net application can you append a % to the value. For example if the value is 'Tek', set it to 'Tek%'.

Your sql would then read:
select * from t1 where f1 like ?

Hope this helps.

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top