Im going to try to indicate my process yhe best that I can maybe you can provide me some guidance on whats yhe best practice to do what I want.
I have a variable lets call it @account with that variable I get some key values for my result set.
Select id, port from mytable where accountnum = @account
The result from this query might yield one row or many rows which is totally fine. For each row in that result set I need to execute a stored procedure.
Exec procedured usp_history
The values of this execution I need to keep adding to a tmp table that at the end will return all the data I need.
How can accomplish this effectively that it is not costing performance?
Thanks in advance for your update