例如:
create proc mes_test2
@i int
as
begin
--一些操作
select @i
end
create proc mes_test1
as
begin
--一些操作
exec mes_test2 '2'
--一些操作
end
在mes_test1中呼叫mes_test2 時不回傳mes_test2 的select(mes_test2 的select不能去掉,其他要用到)
有沒有大佬知道sql上有沒有什么set ..on 之類的把回傳的截斷
uj5u.com熱心網友回復:
第一:加引數給mes_test2,判斷是否選擇第二:回傳多個結果,程式可以處理
第三:使用insert into ...... exec mes_test2,將結果存到表變數或者臨時表,不回傳
第一個最好,在2里直接忽略,性能高
uj5u.com熱心網友回復:
create proc mes_test2
@i INT,
@output BIT=1 --增加是否輸出的引數
as
begin
--一些操作
--如果要求輸出,才 select 輸出
IF @output=1
BEGIN
select @i
END
end
GO
create proc mes_test1
as
begin
--一些操作
exec mes_test2 '2',0
--一些操作
end
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/250859.html
標籤:疑難問題
上一篇:SQL 截取字串
