Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I found this select syntax online but not able to make it work. Please help.

I have a table that have colName as TEXT column that has special ascii characters from 0 thru 31. I an trying to do a select for this colName that will replace all special characters as '?' What am I doing wrong in this select?

select REPLACE(**colName**, 
            PATINDEX('%[^a-zA-Z0-9 ]%', 
                  **colName** collate Latin1_General_BIN), 1), '?')
from table 
WHERE PATINDEX('%[^a-zA-Z0-9 ]%', **colName** collate Latin1_General_BIN) <> 0

asked 25 Mar '13, 17:00

hm9m's gravatar image

accept rate: 0%

closed 26 Mar '13, 16:03

Mark%20Culp's gravatar image

Mark Culp


What database software are you using? ... I ask because the 'collate Latin1_General_BIN' syntax is not supported by SQL Anywhere ... so where did you find the syntax online.

Please refer to the SA documentation which you can find at - specifically you can find the patindex function here.

(25 Mar '13, 21:47) Mark Culp

We have Adaptive Server Enterprise.

(26 Mar '13, 14:49) hm9m
Replies hidden
Comment Text Removed

This isn't the forum you're looking for...

(26 Mar '13, 15:41) Breck Carter

Be careful: The Empire HANA Strikes Back...

(27 Mar '13, 12:18) Volker Barth

The question has been closed for the following reason "Question is off-topic or not relevant" by Mark Culp 26 Mar '13, 16:03

Take a look at my answer to a similar question.

permanent link

answered 25 Mar '13, 21:51

Mark%20Culp's gravatar image

Mark Culp
accept rate: 41%

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 25 Mar '13, 17:00

question was seen: 6,690 times

last updated: 27 Mar '13, 12:18