How to call stored procedure from external database

How to call stored procedure from external database

  

Hi,

I am using external Database in my web application.

How to call the stored procedure.

I tried like below, I am getting invalid procedure error.

SyntaxEditor Code Snippet

EXEC [Porcedurename] @parameter



I tried this one too

/* %LogicalDatabase%=GetLogicalDatabase({Entity Name}) */

Still i am getting same error

https://www.outsystems.com/help/servicestudio/8.0/Using_Data/Advanced_Logic_Canvas.htm

Hi Sekar,

Which database are you using as external DB?

Sachin



Solution

Hi Sekar,

If you are trying to test your call in service studio testing the SQL query you may need to do something like this:

/* %LogicalDatabase%=GetLogicalDatabase({UNIT}) */
--Select {UNIT}.*
--from {UNIT}
EXEC [AxDB30SpEU].[dbo].[getItemCodeName]

But if you execute the code in runtime it should run without this part:

--Select {UNIT}.*
--from {UNIT}

This is for SQLServer. 

You can find more details on the following post: https://www.outsystems.com/forums/discussion/14867/how-to-execute-stored-procedures/

Hope it helps.

Ana

Solution

Hi Ana,

I read that article 

What is {Unit} Here,

Table name?


Sachin Mahawar wrote:

Hi Sekar,

Which database are you using as external DB?

Sachin


SQL Server



Sekar wrote:

Hi Ana,

I read that article 

What is {Unit} Here,

Table name?



Hi Sekar,

Yes, {Unit} is an example of a table name from the database your procedure is in.

If Output entities are multiple tables means how to specify ?


SyntaxEditor Code Snippet

/* %LogicalDatabase%=GetLogicalDatabase({Table1}) */

Ana Reis wrote:

Hi Sekar,

If you are trying to test your call in service studio testing the SQL query you may need to do something like this:

/* %LogicalDatabase%=GetLogicalDatabase({UNIT}) */
--Select {UNIT}.*
--from {UNIT}
EXEC [AxDB30SpEU].[dbo].[getItemCodeName]

But if you execute the code in runtime it should run without this part:

--Select {UNIT}.*
--from {UNIT}

This is for SQLServer. 

You can find more details on the following post: https://www.outsystems.com/forums/discussion/14867/how-to-execute-stored-procedures/

Hope it helps.

Ana


Hi Ana,

I see that the EXEC is followed by [AxDB30speu].[dbo].[getItemCodeName]. I would like to know what this is?

Regards,

Samuel Stephen