COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: VonDobsky on 24 Nov 2008 10:07:24 AM

Title: DB2 SQL vs. Native SQL
Post by: VonDobsky on 24 Nov 2008 10:07:24 AM
Hi...ok i will be more specific than last post..

I am having issues with some Vendor specific functions with DB2 that spits out errors due it not being Native sql.
for instance,

cast_date(cast_integer(substring([Z010U].[CFCSCCHLINEHIST].[ACTIVITYDATE],5,2)),cast_integer(substring([Z010U].[CFCSCCHLINEHIST].[ACTIVITYDATE],7,2)),cast_integer(substring([Z010U].[CFCSCCHLINEHIST].[ACTIVITYDATE],1,4)))

What's wrong here? it validates, but won't run properly.


Title: Re: DB2 SQL vs. Native SQL
Post by: blom0344 on 25 Nov 2008 04:29:48 AM
AFAIK cast_date and cast_integer are cognos functions. If you use this as native SQL then the DB2 UDA will not be able to compile these. At report level the validation will succeed as the expression is a valid Cognos expression..
Title: Re: DB2 SQL vs. Native SQL
Post by: angela on 03 Dec 2008 03:13:02 PM
Try this:
     date(substring(trim(char([Z010U].[CFCSCCHLINEHIST].[ACTIVITYDATE])), 5, 2)||
            '-' ||
            substring(trim(char([Z010U].[CFCSCCHLINEHIST].[ACTIVITYDATE])), 7, 2) ||
            '-' ||
            substring(trim(char([Z010U].[CFCSCCHLINEHIST].[ACTIVITYDATE])), 1, 4))
           ) as ACTIVITYDATE


You may have to play with it a bit.  And don't use Cognos SQL.