If I have a value in column WorkoutID
that looks like 100,10,7
and I want to remove the value 10
from this, I can use the following SQL script:
UPDATE
UserDB.Programs
SET
WorkoutID = REPLACE(WorkoutID, ',10','')
WHERE
ProgramID = '7172';
which would correctly output 100,7
.
The expected outcome ALWAYS needs to be
number, number
, or number
NOT number,,number
, or number,
or ,number
which makes it tricky because in the replace
statement, i need to look for the value, but how can I assume the comma position? i.e replace(WorkoutID, ',10', '')
, or replace(WorkoutID, '10,', '')