COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: naveen10046 on 09 Sep 2017 06:46:57 AM

Title: Manipulate Cognos Escape Character (' to \)
Post by: naveen10046 on 09 Sep 2017 06:46:57 AM
Hi Guys,

I have a scenario where a field value contains apostrophe (ex: parry's), we have recently migrated from DB2 to Cloudera Impala.
Cognos is adding escape character single quote in the value (parry''s) which worked fine in DB2 while Impala expects backslash as escape character (parry\'s).

Any idea how to achieve this?


Thanks,
Naveen
Title: Re: Manipulate Cognos Escape Character (' to \)
Post by: the6campbells on 10 Sep 2017 07:00:59 AM
Cloudera appears to have aligned with SQL standard/vendors in general in their more recent releases of Impala

https://www.cloudera.com/documentation/enterprise/5-8-x/topics/impala_literals.html#string_literals

To include a single quotation character within a string value, enclose the literal with either single or double quotation marks, and optionally escape the single quote as a \' sequence. Earlier releases required escaping a single quote inside double quotes. Continue using escape sequences in this case if you also need to run your SQL code on older versions of Impala.