sp_describe_first_result_set
Returns the metadata for the first possible result set of the Transact-SQL batch.
What changes
- Input
- Returns the metadata for the first possible result set of the Transact-SQL batch.
- Output or change
- No write is stated in the Microsoft summary.
Syntax at a glance
sp_describe_first_result_set [ @tsql = ] N'tsql'
[ , [ @params = ] N'@parameter_name data_type [ , ... n ]' ]
[ , [ @browse_information_mode = ] <tinyint> ]
[ ; ]
Work example
Returns the metadata for the first possible result set of the Transact-SQL batch.
Write a proposed call on paper. Name the target, required permission, expected change, and recovery step before any lab use.
Check your work Returns result-column metadata without running the SELECT. The caller needs permission to execute the statement being described.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
EXEC sys.sp_describe_first_result_set @tsql = N'SELECT ItemId, Price * Quantity AS LineTotal FROM (VALUES (1, 12.50, 2), (2, 3.25, 4)) AS LineItems(ItemId, Price, Quantity)';
Open Microsoft Learn for full syntax, permissions, and details for your version.