I have a stored procedure that returns 3 recordsets. For example:
create proc usp_Example
as
select * from table1_tbl
select * from table2_tbl
select * from table3_tbl
Now obviously the sp I have is much more complex and uses several
input parameters. My question is whether or not it would be better to
encapsulate the select statements into stored procedures and then have
the main procedure call the other 3 procedures.
E.G.,
create proc usp_Example2
as
begin
EXEC usp_get_table1
end
begin
EXEC usp_get_table2
end
begin
EXEC usp_get_table3
end
The reson I am thinking of this approach is that some of those
get_table sps get reused in several places - right now they exist as
blocks of code (select statements) within several different (larger)
stored procedures.
I'd like to take a modular approach, as long as there is a performance
cost. Can someone give the pros and cons? Would the first example
execute faster or the second?
this is on SQL 7.
Thanks,
Jack Gardner