Slavisa
Slavisa

Reputation: 966

How to adjust SQL LIKE function?

I want to make this kind of query:

create procedure something
  @name varchar(13)
as
begin

  select * 
   from WORKER
  where NAME LIKE "%@name%"

end

For input @name=ho, I want output every row that contains NAME which sounds ho,

for example HOuse, soHO, broHOw...

Upvotes: 3

Views: 384

Answers (2)

John Saunders
John Saunders

Reputation: 161773

create procedure something
@name varchar(13)
as
begin
select * from WORKER
where NAME LIKE '%' + @name + '%'
end

Upvotes: 2

David Espart
David Espart

Reputation: 11780

Select * from WORKER where Name Like '%' + @name + '%'

Upvotes: 9

Related Questions