I have question about SQL Server's LIKE
operator.
I have a table Table1
:
app ex
----------
test 210
I am writing some select from program select is looks like this:
select app
from Table1
where ex Like = '210203'
I have tried to use (%,%.%,[]
).
If I try []
this one like this [210]203 it is working but there will be more data so if there will be 2102 in ex I want this to choose this one.
But it isn't selecting nothing beacouse ver is 210203 and in ex is 210
How can I manage this that I selected 210 the variable can't be changed there will be always variable bigger than 'ex' data
Please help me anyone.
You query is not right, you don't use "=" operator in Like.
SELECT app FROM Table1 WHERE ex LIKE '%210%'
In this case will filter values who have 210 inside.
If you use for ex: Like ='%210'
will filter values who ends with 210.. and so on.
Update
You can use this too, i think will help you
declare @Value varchar(50)
set @value = '123AAAAA123'
select * from Table where @Value like '%' + column + '%'