COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: fgarav on 08 Jul 2009 02:53:05 PM

Title: Modify query definition
Post by: fgarav on 08 Jul 2009 02:53:05 PM
Hi everybody
during / after creation on  query subject my question is if is possible modify the SQL language to cast value...
normaly when i run metadatawizard it produce something like select * from table,is possible declare the file i need but is possible do someting like this
CAST(REDDITO / 60 AS varchar(7)) + ':' + RIGHT('00' + CAST(ABS(REDDITO) % 60 AS varchar(2)), 2) AS REDDITO,
    CAST(COSTO / 60 AS varchar(7)) + ':' + RIGHT('00' + CAST(ABS(COSTO) % 60 AS varchar(2)), 2) AS COSTO,
    CAST(ASSENZA / 60 AS varchar(7)) + ':' + RIGHT('00' + CAST(ABS(ASSENZA) % 60 AS varchar(2)), 2) AS ASSENZA,
    CAST(FERIE / 60 AS varchar(7)) + ':' + RIGHT('00' + CAST(ABS(FERIE) % 60 AS varchar(2)), 2) AS FERIE

if yes there is some kind of error near RIGHT .. can someone say me where is the error ?

Bye
Title: Re: Modify query definition
Post by: blom0344 on 08 Jul 2009 03:31:25 PM
Check your syntax , using  '+' to concatenate is pure T-sql (which will only work with native setting when running against SQL server).
More appropriate is  '||' (double pipe)
Title: Re: Modify query definition
Post by: fgarav on 09 Jul 2009 05:01:31 AM
thx blom0344 , i have found the solution and is what u mean..can u check my new post ?
Title: Re: Modify query definition
Post by: fgarav on 09 Jul 2009 05:03:01 AM
sorry blom0344 the post is this:
Time in Seconds but Display as Hours, Minutes and Seconds but be able to SUM