I have the following table with (man-made) IDs.
ID Name
AB12345 John
12346 Charles
...
How do I write a SELECT that returns only the number segment of the ID column? Like this:
ID Name
12345 John
12346 Charles
...
I have the following table with (man-made) IDs.
ID Name
AB12345 John
12346 Charles
...
How do I write a SELECT that returns only the number segment of the ID column? Like this:
ID Name
12345 John
12346 Charles
...
You could write a regex to extract the numeric values that you are looking for.
This might help
SELECT SUBSTRING(string, PATINDEX('%[0-9]%', string), PATINDEX('%[0-9][^0-9]%', string + 't') - PATINDEX('%[0-9]%',
string) + 1) AS Number
FROM table
here string is equal to id