SELECT SUBSTRING([custom_data],charindex('track',[custom_data]),datalength(custom_data)) AS Track2
FROM [dbo].[Sheet3$]
WHERE charindex('track',[custom_data]) > 0
When you say "remove 'track'", do you mean that you want to remove the first four characters, or do you mean that you want to remove all leading non-numeric characters (regardless of how many such non-numeric characters there are), or something else?
If it is the first four characters you are trying to remove,
SELECT
STUFF(Track2,1,4,'') AS Track2
FROM
(
SELECT
SUBSTRING([custom_data],
CHARINDEX('track22', [custom_data]), 28) AS Track2
FROM
[dbo].[Sheet3$]
WHERE
CHARINDEX('track22', [custom_data]) > 0
)s;
If you are trying to remove all the leading non-numeric characters, then this:
SELECT
STUFF(Track2,1,PATINDEX('%[0-9]%',Track2+'0')-1,'') AS Track2
FROM
(
SELECT
SUBSTRING([custom_data],
CHARINDEX('track22', [custom_data]), 28) AS Track2
FROM
[dbo].[Sheet3$]
WHERE
CHARINDEX('track22', [custom_data]) > 0
)s;
If the rule for removing the leading characters is something else, please post the rule.