Search code examples
sql-serverstored-proceduresprocessing-efficiency

Call stored procedures from another stored procedure or only one SP for better efficiency?


I need to update 9 Tables. These tables should be updated by Stored Procedure.

There are pair of three dependent tables in a group. The rest of others (3 more tables) they don have any dependency.

Here is the question: It is more efficient to write 1 store procedure and update all tables or Write 9 SP or Write 6 SP (1 SP for each independent table and for group of dependent tables 1 SP for each then 1 SP to call all)

What is the best way?


Solution

  • Assuming that you are updating 9 tables in one action like(button click),maintaining transaction may be your requirement ,so i would like to suggest you to make one storedprocedures and maintain transaction in it,rather than 9 different procedures..