Focal Point
On using 2 sqls

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8131082392

July 28, 2008, 08:24 AM
Vasantha kumar
On using 2 sqls
hi,

I am generating a SQL report.

My question is, how do i use two different SQL's (can't join those SQL's) in a single fex?

I want to hold the output of one SQL in a variable and show it in report header?

Help me..


Vasantha kumar
7.1.4/ Unix / OF:EXL2K
July 28, 2008, 08:27 AM
susannah
your puzzle is that you want 2 SQLOUT files?
is that it?
create the first one and 'rename' it.
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS MYFIRSTONE
END
now create the second one.
you'll have 2 flat files now in your agent
the first called MYFIRSTONE
and the 2nd called SQLOUT
is that your question?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
July 31, 2008, 06:52 AM
<Dane>
Vasantha, try this:
ON TABLE HOLD AS HOLDONE
END
HOLD AS HOLDTWO
you can just redump the interal matrix after the table request.
July 31, 2008, 09:24 AM
Tom Flynn
Vasantha,

Here is an example, using MSSQL, related to your question:

Say, you have a fex called RPT1. In RPT1 is the following:

  
-DEFAULT &SERVER_NAME = 'xx.x.x.xxx';
-SET &CONNECTION      = IF &SERVER_NAME EQ 'x.x.x.xxx' THEN 'development' ELSE  'prodution';
-*------------------------------------------------------------------------
-* Call Stored Procedure #1
-*------------------------------------------------------------------------
SQL SQLMSS SET SERVER &CONNECTION
SQL SQLMSS EX DataBase.DBO.SQL_Stored_proc1 '&VAR1', '&VAR2', '&VAR3', &VAR4;
 
-*------------------------------------------------------------------------
-* Read the data into a hold file.
-*------------------------------------------------------------------------
TABLE FILE SQLOUT
SUM
    COLUMN1
    COLUMN2
    COLUMN3
 ON TABLE HOLD AS PASS1 FORMAT ALPHA
END
-RUN
-READ PASS1 &COL1.AXX. &COL2.AXX. &COL3.AXX

-*------------------------------------------------------------------------
-* Call Stored Procedure #2
-*------------------------------------------------------------------------
SQL SQLMSS SET SERVER &CONNECTION
SQL SQLMSS EX DataBase.DBO.SQL_Stored_proc2 '&VAR1', '&VAR2', '&VAR3', &VAR4;
 
-*------------------------------------------------------------------------
-* Read the data into a hold file.
-*------------------------------------------------------------------------
TABLE FILE SQLOUT
SUM
    COLUMN1
    COLUMN2
    COLUMN3
 ON TABLE HOLD AS PASS2 FORMAT ALPHA
END
-RUN


The report is now generated from the HOLD file PASS2.
&COL1, &COL2, &COL3 are now available to be placed in your HEADING

&SERVER_NAME and &CONNECTION are examples only, you need to replace them with your data

&VAR 1-4 are variables being passed to the stored proc.

Hope this helps...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe