How to store the result of a storedprocedure to a table variable

2011-05-28

declare @tblVar TABLE
(
spid INT,
ecit int,
status varchar(20),
loginname varchar(20),
hostname varchar(20),
blk int,
dbname varchar(30),
cmd varchar(max),
reques_id int
)

INSERT INTO @tblVar
exec sp_who 'sa'

select * from @tblVar where hostname = 'BIDC22'

0 comments: