IBM Cognos and Motio Best Practices Blog

How to Identify Cognos Reports with Embedded SQL

Posted by Kevin Strong on Wed, Sep 07, 2016 @ 09:30 AM
Find me on:

A common question that keeps getting asked of the MotioPI Support Staff is how to identify IBM Cognos reports, queries, etc. that utilize in-line SQL in their specifications. While most reports leverage a package to access your data warehouse, it is possible for reports to run SQL statements directly against the database, bypassing your package. Let's talk about why it's important to know which reports have embedded SQL.


Why it's Important to Identify Cognos Reports with Embedded SQL

Due to the nature of hard-coded SQL statements, they require continual oversight and maintenance. In fact, if you make changes in your database it can be almost impossible to identify which reports have assumptions built in to their in-line SQL. Until they fail to run that is. Because of how difficult it is to maintain reports with embedded SQL, it is imperative to identify them so you can provide them the extra attention they require. This attention can take the form of removing the embedded SQL or updating the SQL to conform with changes to your data warehouse. Let's explore how to use MotioPI to identify these "special" reports.

How to Use MotioPI to Find Cognos Reports with Embedded SQL

The Search & Replace Panel in MotioPI is designed to search over the specifications of your report, identify reports that match criteria set by you, and even perform simple changes on a set of Cognos objects. Today we will utilize the search feature of Search & Replace to quickly identify all reports that use embedded SQL so you can validate their contents, convert them to use the model, or remove them from production altogether.

    1. Open the Search & Replace panel in MotioPI. If needed, narrow down your search to only cover sections of your content store, which can be particularly helpful if you are only concerned with a subsection of your content store or are concerned about the speed of your search in MotioPI. To Narrow, select the "Narrow" button

      narrow button
      Click to enlarge

    2. Select the files or folder that you want to conduct your search in and then select the ">>" button.Select Cognos Files to SearchClick to enlarge
    3. Enter in “<sqlText>” (without quotes) in the search field.Enter Regex Expression in CognosClick to enlarge
    4. Press the "Search" button. 

      Submit SearchClick to enlarge

    5. MotioPI will return all reports that contain embedded SQL from your search.

      View Results
      Click to enlarge
    6. Note that you can mouse over a snippet to see the full text of your SQL. View SQL text

      Click to enlarge

    7.  Once you have located all of your reports with embedded SQL, you can document them using the export feature in MotioPI (File->Export output), move them to one location using MotioPI so that you can easily locate them in the future, or even perform simple transformations on the spec using the "Replace" feature of the Search & Replace Panel.



CONCLUSION:

That is how you can use the Search & Replace panel in MotioPI to identify all reports with embedded SQL. You may get a few false positives using this technique, but that is done so that MotioPI does not miss any reports with embedded SQL. You can also narrow your search terms so that you only search for the exact syntax of your SQL statements. If you have any questions about how to best use the Search & Replace Panel, just ask below in the comments, I’m always happy to share any Cognos knowledge I may have!

Get Your PI Pro Trial Here. Now. Free.

Tags: Cognos management, Cognos admin tools, IBM Cognos, motiopi