You can accomplish this with OPENROWSET in accordance with this question .
sp_configure 'Show Advanced Options', 1
GO
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE
GO
SELECT * INTO #MyTempTable FROM OPENROWSET('SQLNCLI', 'Server=(local)\SQL2008;Trusted_Connection=yes;',
'EXEC sp_who')
SELECT * FROM
If for some reason you cannot use OPENROWSET, you will need to create a temporary table that exactly matches the output sp_who.
eg
Create Table
(
spid smallint,
ecid smallint,
status varchar(100),
loginame varchar(100),
hostname varchar(100),
blk smallint,
dbname varchar(100),
cmd varchar(100),
request_id smallint
)
Insert Into
Exec sp_who
Select * From
source
share