MSSQLTips.com · July 23, 2025
Ways to Return Result Sets with SQL Server Stored Procedures
This article compares SQL Server mechanisms for returning data from reusable routines, using examples from AdventureWorks2017. It distinguishes scalar output parameters, table-valued functions that can participate in queries, and stored procedures that return one or more result sets.
The examples demonstrate how a procedure can return department and employee information separately, how WITH RESULT SETS can define output column names and types, and how INSERT EXEC can capture a compatible result set in a temporary table. The discussion relates these techniques to reporting, application integration and reusable query design.