I want to update a row which is in format like this ABC - DEF - GHI - ABD,
Using a cmd like this UPDATE tbl SET col = Replace(col,@var, '') WHERE Pk=something. How can I remove the trailing or leading hyphens? For exmaple if @var is GHI, after replace, row value should be ABC-DEF-ABD or if @var is ABC then value should be DEF – GHI – ABD.
I want to update a row which is in format like this ABC –
Share
First of all, agree completely with comment above.. Change teh data sschema to not store delimited lists of values in database column.
But, if this is not possible, Try this: