Ah.. what I posted will remove the part before the first tab.
When you want to replace, what is the rule that you want to use? It seems like you want to have a fixed length to the number that is appended? For example PH01278104 --> string278104. Why is the 01 omitted? Is it because you want to keep only six digits, or is it something else?
DECLARE @tab TABLE( col VARCHAR(30)) insert into @tab SELECT 'PH01000000G0240' UNION ALL -- String0G0240 SELECT 'PH01000001G0190' UNION ALL -- String1G0190 SELECT 'PH01278104G0010' UNION ALL String278104G0010 SELECT 'PH01278028G0210' --String278028G0210
SELECT 'String' +CAST(CAST(SUBSTRING(col, 5, 6) AS INT) AS VARCHAR(10))+ RIGHT(col, 5) FROM @tab