The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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

asked 11 Feb '16, 08:51

aihbrb's gravatar image

aihbrb
31112
accept rate: 0%


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.

permanent link

answered 11 Feb '16, 09:09

Volker%20Barth's gravatar image

Volker Barth
29.3k287438644
accept rate: 32%

edited 11 Feb '16, 09:10

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.

permanent link

answered 11 Feb '16, 12:17

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
6.2k2890
accept rate: 30%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×2

question asked: 11 Feb '16, 08:51

question was seen: 189 times

last updated: 11 Feb '16, 12:17