08-16-2023 06:08 PM
I want to execute a list of DB Stored procedures after executing a DM step in OS. Is it possible to call a DB Stored Procedure from OS?After the Stored Procedures are run, I want to execute a list of DM Jobs for data imports to cube.
Appreciate any pointers how I can implement this.
Solved! Go to Solution.
08-17-2023 09:26 AM
Yes, you can call a stored procedure from OS:
Do something like this in a business rule:
Using dbConnApp = BRApi.Database.CreateApplicationDbConnInfo(si)
BRApi.Database.ExecuteActionQuery(dbConnApp, "EXEC [StoredProc]", True, True)
End Using
08-17-2023 09:26 AM
Yes, you can call a stored procedure from OS:
Do something like this in a business rule:
Using dbConnApp = BRApi.Database.CreateApplicationDbConnInfo(si)
BRApi.Database.ExecuteActionQuery(dbConnApp, "EXEC [StoredProc]", True, True)
End Using
08-17-2023 12:18 PM
Thanks Steve! Is the [StoredProc] is a string that contains the Stored Procedure (line of codes) and need to be within the BR?
08-17-2023 12:23 PM
[StoredProc] is the name of the stored procedure you are running.
I have a stored procedure named TruncateMyTable
I would be: Exec TruncateMyTable
08-17-2023 01:32 PM
Thanks I will try that
08-21-2023 10:00 PM
I am able to execute the stored procedure. Now as a next step I need to execute a Data Management job to import the data from DB to OS Cube.
Prior to that I need to check whether the stored procedure executed successfully without errors. How can I check for errors within the BR? The brapi.Database.ExecuteActionQuery command has a Boolean parameter to log errors. But I am not sure how I can access those error messages.