Best practice to get stored procedure returns title Names in T-SQL
I have a stored procedure in with a bottom body that inserts a car, then gets it: Sql Server 2008
ALTER PROCEDURE [dbo].[sp_Car_Insert]
@RunDate VARCHAR(25),
@CarNo NVARCHAR(50),
@Volume INT,
@Weight SMALLINT,
@CarName NVARCHAR(50),
@InUse BIT,
@CarID TINYINT OUTPUT
AS
BEGIN
SELECT @CarID = ISNULL(MAX(c.CarID), 0) + 1
FROM Car c
INSERT INTO Car
(
CarID,
RunDate,
CarNo,
Volume,
[Weight],
CarName,
InUse,
IsDeleted
)
VALUES
(
@CarID,
@RunDate,
@CarNo,
@Volume,
@Weight,
@CarName,
@InUse,
0
)
SELECT *
FROM Car
WHERE CarID = @CarID
END
I want to know if there is a way to get the selected column headers in T-SQL or not? Is there any solution for getting them?
For example: we can get the headers of the function tables by a table INFORMATION_SCHEMA.ROUTINE_COLUMNS
. Is there any information in to get the returned headers of procedures? sql server
source to share
sys.dm_exec_describe_first_result_set_for_object
This dynamic management function takes an @object_id parameter as a parameter and describes the metadata of the first result for a module with that ID. The @object_id specified can be a Transact-SQL stored procedure identifier or a Transact-SQL trigger.
It only describes the first set of results.
source to share