//Shows the list of each column with details, that are returned from the Stored Procedure in SQL Server
For instance, there is Stored Procedure SprocGetUsersList. Now, if User wants to see the data type of each column in the list returned from that Proc, here's solution:
SELECT p.name, r.*
FROM sys.procedures AS p
CROSS APPLY sys.dm_exec_describe_first_result_set_for_object(p.object_id, 0) AS r
where p.name='SprocGetUsersList';
GO
Compatibility:
SQL Server (starting with 2012)Azure SQL Database
References:
https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-describe-first-result-set-for-object-transact-sql
For instance, there is Stored Procedure SprocGetUsersList. Now, if User wants to see the data type of each column in the list returned from that Proc, here's solution:
SELECT p.name, r.*
FROM sys.procedures AS p
CROSS APPLY sys.dm_exec_describe_first_result_set_for_object(p.object_id, 0) AS r
where p.name='SprocGetUsersList';
GO
Compatibility:
SQL Server (starting with 2012)Azure SQL Database
References:
https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-describe-first-result-set-for-object-transact-sql