By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
WITH xTable AS (
SELECT 'COMP-LAP-0001' xColumn
UNION ALL SELECT 'COMP-0001'
)
SELECT STUFF(xColumn, CHARINDEX('-', xColumn), 1, ';') FROM xTable
(No column name) |
---|
COMP;LAP-0001 |
COMP;0001 |