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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE %?

Status
Not open for further replies.

RJ5

Programmer
Jun 17, 2001
22
PH
Hello again.

I'm having difficulty with the LIKE condition.

e.g.

CREATE PROCEDURE sp_NAME
@lastname varchar(10)
AS
SELECT * FROM tbl1 WHERE wholename like %@lastname%

How do I use a variable in a LIKE condition? I'm going to execute the SP in VB6.

Thanks for any suggestion

Randy : )

 
try something as

SELECT * FROM tbl1 WHERE wholename like '%' + '@lastname' + '%'
John Fill
1c.bmp


ivfmd@mail.md
 
many thanks john.

stay cool.
 
I think you'll find this works.

SELECT * FROM tbl1 WHERE wholename like '%' + @lastname + '%'
Terry

"I'm not dumb. I just have a command of thoroughly useless information." - Calvin, of Calvin and Hobbes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top