Here I am explaining four stored procedures to show use of different type of like in SQL Server.
--we have selected all rows for which UserName which contains @name .
create proc like1
@name varchar(200)
as
begin
select * from tbl_User where UserName like''+'%'+@name+'%'+''
End
--we have selected all rows for which UserName starts with any character between 'a' and 'r'.
create proc like2
@name varchar(200)
as
begin
select * from tbl_User where UserName like''+'[a-r]%'+@name+'%'+''

Join the conversation! Your thoughts help the community grow.