Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
HiI have a series of alphanumeric values where the first character is always a letter A-F and the following characters are always numerics. I would like to select only the number part of the alphanumeric which can be one or two digits long. Do you know the correct function for this? ie. A9 = 9A10 = 10Thanks
Or, to allow for any length of non-numeric prefix:
SELECT SUBSTRING(string, PATINDEX('[%0-9%]', string), 100) AS numeric_stringFROM ( SELECT 'A9' AS string UNION ALL SELECT 'A10' UNION ALL SELECT 'AA555' UNION ALL SELECT 'AAAA11111') AS test_data