Hello,
I need to know how to strip leading zeroes from a string. I've seen some examples that work with stripping leading zeroes from a numeric string and several that work stripping from a character string but I have a field that can be both. Two examples are:
00000000001234 should convert to 1234
0000WEB0005678 should convert to WEB0005678
All strings are 14 characters in length.
The following code works for the non-numeric string but not the numeric string:
Code:
SELECT substring(@charValue, patindex('%[a-Z]%',@charValue), len(@charValue) - patindex('%[a-Z]%',@charValue) + 1)
How can I modify it so that it works with both? Any help would be greatly appreciated.