on 2016 Feb 11 8:51 AM
Hello,
is there an easy way to select only the digits from a varchar column in Sqlanywhere 12 or 16? I would like to remove all other chars than digits from the varchar. (1234)56/78 should be 12345678.
Thank you Andreas
Regular Expressions are useful in search criteria but not really applicable to string manipulation. You can try using the REPLACE() function, as in:
select replace(
replace(
replace('(1234)56/78','(','')
,')','')
,'/','')
And yes, there are 3 nested calls to this function, 1 per character to be replaced.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Look at that other FAQ with a similar, although more general topic:
How to strip several different characters from a string?
Mark's first sample should do the trick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.