My current data set has a value that is acceptablevalue_5cjunk data. The data that I want to remove using SQL is the string that starts with _5c.
I have tried using a replace statement with a like function which does not work.
IF OBJECT_ID('mytable') IS NOT NULL drop table mytable
CREATE TABLE mytable
([mycol] varchar(50))
;
INSERT INTO mytable
([mycol])
VALUES
('97W'),
('125_5c0a9abac73d4'),
('121_5c0a9abac73d4'),
('121_5c0a9abac73d4'),
('123_5c0a9abac73d4'),
('112H'),
('111H')
;
SELECT REPLACE([mycol],like'_5c%','')
from mytable
What I would like to see is:
97W
125
121
121
123
112H
111H