Calling an SQL Stored Procedure from C/AL

I would like to have the possibility of calling a SQL Stored Procedure from C/AL (passing parameters and retrieving Return code) Does anybody out there have something to do that? Regards, Jesús Soage

Look at the Appendix A.3 of the Documentation on SQLserver for Navision. There is everything you need to call stored procedures.

I can’t find the documentation you mentioned. I am using Financials 2.60. Does this documentation belong to this version? Thanks in advance. Jesús Soage

The documentation is written for Attain. But the procedure to follow should also work in Financials. What you need is an Automation object of type ‘Microsoft SQLDMO Object library’.SQLServer and one of type ‘Microsoft SQLDMO Object library’.QueryResults. Use the following code to run a stored procedure with these objects : clear(SQLServer); create(SQLServer); SQLServer.connect(‘Servername’,‘login’,‘password’); SQLQueryResult := SQLServer.executewithresults(‘EXEC databasename…[stored procedure] param1 param2’);

Thanks a lot. I will try. Regards, Jesús Soage