Focal Point
[CLOSED]How to capture MS SQL Server Stored Procedure output

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

June 24, 2016, 01:46 PM
rajje
[CLOSED]How to capture MS SQL Server Stored Procedure output
I have a stored procedure that returns a '1' using "SELECT '1'" to signify that it completed successfully. I use this stored proc to update a table in WebFOCUS as follows:

ENGINE SQLMSS SET DEFAULT_CONNECTION BI
SQL SQLMSS EX dbo.usp_FSG_ScoreCard_Exception_Group '&METRIC', &SOURCE ,&METRIC_GK, '&REQUESTOR' , &REASON, '&TYPE' , NULL ;
END

In addition, I have another stored proc that I call after the "usp_FSG_ScoreCard_Exception_Group" stored proc as follows:

ENGINE SQLMSS SET DEFAULT_CONNECTION BI
SQL SQLMSS EXEC dbo.usp_LoadFSG_ScoreCardMissingTimeCard
END

My issue is that the second stored proc "usp_LoadFSG_ScoreCardMissingTimeCard" takes around a minute to run since it's updating a huge table. So, since WebFOCUS waits for the second stored proc to complete, a simple update using the first stored proc seems like it takes a minute to run.

How do I make WebFOCUS aware that the first stored proc is complete, start the second stored proc and exit out of my fex without having to wait for the response from the second stored proc?

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8.x, Windows, HTML/PDF
June 24, 2016, 02:06 PM
Ricardo Augusto
Can you use 2 fex, each one to each SP.


WebFOCUS 8.1.05 / APP Studio
June 24, 2016, 02:15 PM
BabakNYC
Can you run your fex's in deferred mode?

Alternatively, you could schedule them to run using CMRUN from the OS command line or in a batch executable.


WebFOCUS 8206, Unix, Windows
June 24, 2016, 02:27 PM
rajje
quote:
Originally posted by Ricardo Augusto:
Can you use 2 fex, each one to each SP.


I will try to create a second fex for the second stored proc? I am new to WebFOCUS, so how would I call the second fex from the first one? Do I just include it using "-INCLUDE"?


WebFOCUS 8.x, Windows, HTML/PDF
June 24, 2016, 02:29 PM
rajje
quote:
Originally posted by BabakNYC:
Can you run your fex's in deferred mode?

Alternatively, you could schedule them to run using CMRUN from the OS command line or in a batch executable.


The fex is in a html file. So I am not sure how I would run it in a deferred mode? I need to execute the second procedure only after the first one is done executing.


WebFOCUS 8.x, Windows, HTML/PDF
June 24, 2016, 02:38 PM
Ricardo Augusto
quote:
I will try to create a second fex for the second stored proc? I am new to WebFOCUS, so how would I call the second fex from the first one? Do I just include it using "-INCLUDE"?



Yes. Use like this -INCLUDE IBFS:/WFC/Repository/app_name/full_path/fex2.fex


WebFOCUS 8.1.05 / APP Studio
June 24, 2016, 02:40 PM
Doug
Have you considered the SQL Trace commands?
June 24, 2016, 02:48 PM
rajje
quote:
Originally posted by Doug:
Have you considered the SQL Trace commands?


I haven't. Could you give me some pointers on how to get started and what I should look for in the trace?


WebFOCUS 8.x, Windows, HTML/PDF
June 24, 2016, 03:36 PM
Doug
Sure, I feel generous today. Add the following to / before your TABLE FILE request
SET XRETRIEVAL = OFF
SET TRACEUSER  = CLIENT
SET TRACEON    = STMTRACE//CLIENT
SET TRACEON    = SQLAGGR//CLIENT
SET TRACESTAMP = OFF
SET TRACEWRAP  = 132
SET EMGSRV     = ON

The results of this can be pasted directly into TOAD, or you SQL tool, for analysis (explain plan).
June 24, 2016, 03:37 PM
Doug
You can create a fex with that code and -INCLUDE it where ever you want it...
October 02, 2020, 05:42 PM
Doug
OK, So I forgot those lines and searched "sql trace commands and found this...

It's true what they say: What goes around ... Comes Around Smiler




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206