How To See CRs And Remove Them (Sybase)

I have a problem with CR (windows format) characters in a Sybase IQ system because of this I like show how to see them. A way is use convert function with binary. Please  look at the next query;

SELECT convert(binary(10), COLUMN_N) FROM MY_TABLE

This return the 10 first bytes of the column COLUMN_N in hexadecimal format;

0x20200d20486f6c61206d

0x is the prefix. 20 is a blank space, the next 20 is other blank space and 0d  is the CR.

If you want remove it (in my case was necessary for app requisites) you can use the next update;

update MY_TABLE set COLUMN_ n = str_replace(COLUMN_n, char(13), null)

HTH – Antonio NAVARRO

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s