Home > database >  SQL stored procedure call, do not return to the stored procedure returned to select, is there a set.
SQL stored procedure call, do not return to the stored procedure returned to select, is there a set.

Time:01-20

For example:
 
The create proc mes_test2
@ I int
As
The begin
- some operating
Select @ I
End

The create proc mes_test1
As
The begin
- some operating
The exec mes_test2 '2'
- some operating
End



Call in mes_test1 mes_test2 without return mes_test2 select (mes_test2 select can't take out, the other will use)
Bosses know SQL on have any set.. On the return of such truncation

CodePudding user response:

First: to add parameters to mes_test2, determine whether to choose
Second: return multiple results, the program can handle
Third: use insert into... Exec mes_test2, to save the result as a table variable, or a temporary table, do not return

The first, best ignored in 2, high performance

CodePudding user response:

 create proc mes_test2 
@ I INT,
@ the output BIT=1 - whether to increase output parameter
As
The begin
- some operating
- if the required output, to select the output
IF @ the output=1
The BEGIN
Select @ I
END
End
GO
The create proc mes_test1
As
The begin
- some operating
The exec mes_test2 '2', 0
- some operating
End
  • Related