Hello Everyone 

I am calling a stored procedure from my service module. and i am forced to put below line. I am okay to put the first line, i don't see any relevant for selecting the record before calling the procedure. Without select statement i am getting bellow error.

/* %LogicalDatabase%=GetLogicalDatabase({prj}) */
-- select top 1 {prj}.* from {prj}

ERROR Message

Database returned the following error:
Error in advanced query SaveProjectHours: Database 'PRJDB' does not exist. Make sure that the name is entered correctly.


Solution

Hello sajesh, 

As far as I can recall, the second line is required to test the query in Service Studio, but is not required during Runtime.

From here: https://www.outsystems.com/forums/discussion/14867/how-to-execute-stored-procedures/

For testing in SQL tool have to be commented select from any table from external DB and explicity written external DB name in call procedure)

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

Cheers.

Solution

Eduardo Jauch wrote:

Hello sajesh, 

As far as I can recall, the second line is required to test the query in Service Studio, but is not required during Runtime.

From here: https://www.outsystems.com/forums/discussion/14867/how-to-execute-stored-procedures/

For testing in SQL tool have to be commented select from any table from external DB and explicity written external DB name in call procedure)

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

Cheers.

Thanks Eduardo Jauch.. It worked.. 


Eduardo Jauch wrote:

Hello sajesh, 

As far as I can recall, the second line is required to test the query in Service Studio, but is not required during Runtime.

From here: https://www.outsystems.com/forums/discussion/14867/how-to-execute-stored-procedures/

For testing in SQL tool have to be commented select from any table from external DB and explicity written external DB name in call procedure)

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

Cheers.


I exactly followed above syntax and the account has access to execute stored proc. Still getting error that 'stored proc not found'. I am testing in service studio sql action.

Question: [AxDB30SpEU] is this the name of the SQL db. If yes, is it exact name of the db in SQL server or name of the external connection in outsystems?