SQLTeam.com | Weblogs | Forums

Simple sql search including space

Below is the sample table. Would like to get record as matching,but not getting with below tried query.
mytable
ID cat_name
100 Bathroom sinks

declare @key varchar(50) ='bathroom sink'
select * from mytable where cat_name like '%@key%'

What is the collation on the table/database?

1 Like

select * from mytable where cat_name like '%' + @key + '%'

2 Likes