sqlserver怎么获取存储过程的返回值
发布网友
发布时间:2022-05-03 16:22
我来回答
共2个回答
热心网友
时间:2022-05-03 17:51
1.OUPUT参数返回值
CREATE PROCEDURE [dbo].[nb_order_insert](
@o_buyerid int ,
@o_id bigint OUTPUT
)
AS
BEGIN
SET NOCOUNT ON;
BEGIN
INSERT INTO [Order](o_buyerid )
VALUES (@o_buyerid )
SET @o_id = @@IDENTITY
END
END
2.存储过程中获得方法:
DECLARE @o_buyerid int
DECLARE @o_id bigint
DECLARE @result bit
EXEC @result = [nb_order_insert] @o_buyerid ,o_id output
3.SELECT 数据集返回值
CREATE PROCEDURE [dbo].[nb_order_select](
@o_id int
)
AS
BEGIN
SET NOCOUNT ON;
SELECT o_id,o_buyerid FROM [Order]
WHERE o_id = @o_id
GO