I need to find out how many rows are returned by a subquery that i'm
executing thru dynamic sql. I will be either using the subquery to return
rows that I then insert into a table as a "batch", or allow the user to
preview how many would be inserted, if they ran it in "production mode".
I can't do : SELECT COUNT(*) FROM (SELECT somevalue FROM somedb..sometable)
INSERT INTO somelocaltable
(SELECT somevalue FROM somedb..sometable)
Again, I'm executing these statements with sp_executesql, since I'm building
the SQL and pointing to variable databases.