Author Topic: getting the generated sql out of a cognos created query  (Read 1438 times)

Offline iouwon

  • Associate
  • **
  • Posts: 2
  • Forum Citizenship: +0/-0
Hi,

We have business analysts who create queries using the cognos web app to find clients of our business who they want to target for marketing purposes.  they can export the data via csv and we can feed that into the automated system we're building for them but we expect the size of this data to be in the gigabytes and would like to be able to use the sdk to get at the query definitions of the queries they save in cognos so that we can execute the queries and import the data directly using federation in db2.

We can see from the documentation that a query object contains a reportVersion object which contains an SQL object which it says is the sql generated by the definition of the query.

Does anybody know how to get at this information using the SDK because the properties of the query object don't seem to provide access to the reportVersion object and the reportVersion object doesn't seem to provide access to the SQL object.

Regards,
Luke

Offline lindero

  • Community Leader
  • *****
  • Posts: 97
  • Forum Citizenship: +2/-0
Re: getting the generated sql out of a cognos created query
« Reply #1 on: 19 Jun 2009 01:29:35 am »
Hi Luke,

maybe this TechNote helps you:

http://www-01.ibm.com/support/docview.wss?uid=swg21344260

cheers,
Lindero

Offline iouwon

  • Associate
  • **
  • Posts: 2
  • Forum Citizenship: +0/-0
Re: getting the generated sql out of a cognos created query
« Reply #2 on: 19 Jun 2009 05:40:26 am »
brilliant.  that looks perfect.  i'll let you know how i get on

Offline jonathanmunge

  • Associate
  • **
  • Posts: 1
  • Forum Citizenship: +0/-0
Re: getting the generated sql out of a cognos created query
« Reply #3 on: 30 Sep 2010 02:42:07 am »
Hi the Sample code from the ibm website was great!

However I noticed that the code returns everything from the xml to both the native and cognos SQL is possible to edit it so that it only returns the native SQL?