Calling DB Stored Procedures from OS

vmanojrc30
New Contributor III

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.

 

 

1 ACCEPTED SOLUTION

Steven
Contributor

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

View solution in original post

5 REPLIES 5

Steven
Contributor

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

vmanojrc30
New Contributor III

Thanks Steve! Is the [StoredProc] is a string that contains the Stored Procedure (line of codes) and need to be within the BR?

Steven
Contributor

[StoredProc] is the name of the stored procedure you are running.

I have a stored procedure named TruncateMyTable

I would be: Exec TruncateMyTable

 

vmanojrc30
New Contributor III

Thanks I will try that

vmanojrc30
New Contributor III

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.