I'm using PATINDEX combined with SUBSTRING to strip off leading zeros or letters. I can strip off either a zero or a letter but not both. For example:
'P102' should return '102'
'P0102' should return '102'
'102' should return '102'
So basically, I'm using PATINDEX to return the position of the first character that is not alphabetic or zero.
select
PATINDEX('%[^A-Z]%','TT04555') --returns 3
select
PATINDEX('%[^0]%','0004555') --returns 4
how do I combine these expressions so that PATINDEX of 'TT04555' returns 4 (position of the first character that is not a letter and is not a zero)??
Thanks