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.
I have a similar task with a restriction that I must not alter the SP to get the count. Hence:
sp_configure 'show advanced options', 1;
reconfigure;
go
sp_configure 'ad hoc distributed queries', 1;
reconfigure;
go
select count(*) from
openrowset('SQLOLEDB','Data Source=localhost;Trusted_Connection=yes;
Integrated Security=SSPI','exec DBNAME..SPName')