How do I count the number of rows a stored procedure would return the fastest way. Stored procedure returns rows around 100K to 1M records.
So far the only thing that has worked for me is to:
a. Modify momentarily the stored procedure to dump the resulting dataset into a table. If changing the stored procedure is not an option replace Alter Procedure with Declare and remove the end, provide parameter values if not optional and execute as a query dumping the dataset into a table.
b. Script the table and drop it using SSMS.
c. Use the script to create a virtual table in the query and use Insert into with exec stored procedure to populate it.
d. Count the records.