參考引用:如何接收 Store Procedure 的傳回值
MSDN:Using a Stored Procedure with Output Parameters
--
CREATE PROCEDURE mysp_QueryData (
@id int,
@LastName Varchar(30) output
)
AS
BEGIN
SELECT @LastName = LastName
FROM Customer
WHERE CustomerID = @id;
END
--
取值:
DECLARE @lname varchar(30);
EXEC mysp_QueryData '1',@lname output;
PRINT @lname;
沒有留言:
張貼留言