I have a stored procedure that I want to call from within another, and then loop through the results. Sort of like using a cursor with a stored procedure rather than a SQL s
you can catch the results of a stored proc by inserting into a table that has matching columns...
create table #spWhoResults
(spid smallint,
ecid smallint,
status nchar(60),
loginame nchar(256),
hostname nchar(256),
blk char(5),
dbname nvarchar(128),
cmd nchar(32),
request_id int)
go
insert #spWhoResults
exec sp_who
select *
from #spWhoResults
/*
put your cursor here to loop #spWhoResults to
perform whatever it is you wanted to do per row
*/