I have a problem.
I want to replace all columns which start with 2,finish with 2 and contain 2 inside. For example for my column;
[Numbers]
1, 2, 22, 33, 4, 5
2, 3, 42, 25, 6
12, 28, 62, 2
I want to replace "only 2" (not 22 or 25 etc.) with X. Here is my query:
UPDATE mytable
set Numbers = replace(Numbers, ',2', ',X') WHERE Numbers like '%,2'
UPDATE mytable
set Numbers = replace(Numbers, ',2,', ',X,') WHERE Numbers like '%,2,%'
UPDATE mytable
set Numbers = replace(Numbers, '2,', 'X,') WHERE Numbers like '2,%'
But output is not true. This code replace all 2 in the column with X.
Can anyone help me? How can I write true query?