What works best: multiple sql server stored procedures with one result or a single multitask stored procedure

Reference Information. I use stored procedures exclusively for an ASP.NET application. I am using DataReader to load a dataset object.

+3
source share
4 answers

Single procedures that return individual results (to ensure the importance of code, simplicity and reuse of procedures), and then one call calls all the necessary procedures:

command = new SqlCommand(@"
exec usp_proc1 @param1, @param2;
exec usp_proc2 @param1, @param3;
exec usp_proc3 @param2, @param4;");

, . , , , .

+4

IMHO , SQL-.

+1

, SP SP , . , SP , , .

+1

Returning all your data in a single query is almost always better, unless it affects the application too much to control the form of that data. Of course, if your returning millions of lines, you probably want to break it into something more lazy, if possible :)

0
source

Source: https://habr.com/ru/post/1758771/


All Articles