I have following data in table
create table Manager(id int, managerid varchar(10) , managername varchar(50))
insert into Manager(id, managerid, managername)
values (1, 'A1', 'Mangesh'), (2, 'A''2', 'Sagar'), (3, '_C[%]3', 'Ah_mad'),
(4, 'A4', 'Mango'), (5, 'B5', 'Sandesh')
I am using stored procedure to get the result on the basis of given characters. One of the users want to search with c[%]
. I am able to handle %
with [%]
but if string is having [%]
then I am unable to find it.
I tried with following query
declare @str varchar(100)='C[[%]'
SELECT m.*
FROM Manager m
WHERE m.managerid LIKE '%'+@str+'%'
This way I am able to get the result but in this case input is C[%
only. I replaced %
with [%]
in my stored procedure parameter. But if input is C[%]
then my query is not returning anything.