The WITH RESULT SETS clause in SQL Server 2014

           When a stored procedure returns rows of data, the names and data types of the columns in the results are determined by the query defined in the stored procedure. By using the WITH RESULTS clause of the EXECUTE statement, you can override the schema of the results to change column names and compatible data types.
This example shows how to use the WITH RESULT SETS clause for a stored procedure that returns a single rowset.

Using the WITH RESULT SETS clause:
     EXECUTE GetOrderPickList ‘SO59384’
           WITH RESULT SETS
           (
           ([SalesOrder] nvarchar(20) NOT NULL,
           [LineItem] int,
           [Product] int,
           [Quantity] int)
           )
When a stored procedure returns multiple rowsets, you can specify a schema for each result set in the
WITH RESULT SETS clause, separated by a comma.
The WITH RESULT SETS clause in SQL Server 2014 The WITH RESULT SETS clause in SQL Server 2014 Reviewed by Unknown on 12:02 AM Rating: 5

No comments:

Powered by Blogger.