Compressing a Character Column containing non-alphabetic characters

Database
Enthusiast

Compressing a Character Column containing non-alphabetic characters

Hi,

Hopefully someone can help me with a problem compressing text values containing non a-z characters, specifically ' and ( .

We have a column containing a number of fixed text entries which we'd like to compress (I'd prefer to convert them into code values but I've been told that's a last resort) and I can't figure out how to code the Compress rule, or if it's even possible.

Normally I'd code something like

TEXT_COL1 CHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL COMPRESS ('Text Value 1', 'Text Value 2')

But how do you do this for values like :

Press Ad (Newspaper, Best buy table) OR

Internet: Ad on Alistair's website

Thanks

Alistair
2 REPLIES
Junior Contributor

Re: Compressing a Character Column containing non-alphabetic characters

Hi Alistair,

there's no problem with (, because it's within the string, but a ' must be doubled:
compress(
'Press Ad (Newspaper, Best buy table)',
'Internet: Ad on Alistair''s website')

Dieter
Enthusiast

Re: Compressing a Character Column containing non-alphabetic characters

Dieter,

Thanks very much for the help, it works perfectly.

We hadn't thought of using ", we'd tried ''' and "'".

Regards

Alistair