stored procedure returns varchar

后端 未结 3 1439
日久生厌
日久生厌 2020-12-30 09:33

I would like to know if in SQL is it possible to return a varchar value from a stored procedure, most of the examples I have seen the return value is an int.

3条回答
  •  悲哀的现实
    2020-12-30 09:47

    You can use out parameter or the resulset to return any data type.
    Return values should always be integer

    CREATE PROCEDURE GetImmediateManager
       @employeeID INT,
       @managerName VARCHAR OUTPUT
    AS
    BEGIN
       SELECT @managerName = ManagerName
       FROM HumanResources.Employee 
       WHERE EmployeeID = @employeeID
    END
    

    Taken from here

提交回复
热议问题