I have a column name Address which consists of some address which has '%' in between as:
Address
--------------------
Aman Ja%lan%
Stree% Ro%ad
etc., etc.
How I can write the LIKE operator to find that pattern?
I tried:
declare @var char(1)
set @var='!%'
select Address from Accomodation where Address like '%'+@var+'%'
This question is related to
sql-server
tsql
sql-like
Try this:
declare @var char(3)
set @var='[%]'
select Address from Accomodation where Address like '%'+@var+'%'
You must use [] cancels the effect of wildcard, so you read % as a normal character, idem about character _
Source: Stackoverflow.com