Page 1 of 1

Stored Procedure question

Posted: Mon Aug 08, 2022 11:53 am
by cbrydon
Hello,

I've started working with a a very basic stored procedure in MSSQL and have a couple of questions.

I have a stored procedure that has 1 input parameter (a DepartmentID ) and the stored procedure
returns all rows from a table for that given department ID.

I can get columns and data returned from a stored procedure when I use the following syntax
EXEC CarlsTest 8 and the type of datasource is set to Query
StoredProcQuery.png
StoredProcQuery.png (8.75 KiB) Viewed 2240 times
I can also get the results I want if I have the datasource setup as a Stored Procedure and use a
parameter to store the DeptID.
StoredProcSP.png
StoredProcSP.png (17.75 KiB) Viewed 2239 times
Is there any advantage to using one method over another or does it just depend on personal
preference and/or the type of query being written?

For a more complex stored procedure is there a performance difference between running a
stored procedure with EXEC (and the datasource type as Query) versus running the stored
procedure with the datasource type as Stored Procedure.

Thank you,
Carl

Re: Stored Procedure question

Posted: Mon Aug 08, 2022 12:12 pm
by Lech Kulikowski
Hello,

Please check the following discussion:
https://stackoverflow.com/questions/598 ... ts-on-mode

Thank you.

Re: Stored Procedure question

Posted: Tue Aug 09, 2022 11:24 am
by cbrydon
OK - Thank you Lech.

Re: Stored Procedure question

Posted: Wed Aug 10, 2022 9:36 am
by Lech Kulikowski
Hello Carl,

You are welcome.