July 21, 2005 at 6:59 am
Is it possible to read the results of sp_who into a temp table or array of some sort?
July 21, 2005 at 7:28 am
Try something like
create table spwhotbl
(
spid int,
ecid int,
status varchar(50),
loginname varchar(100),
hostname varchar(100),
blk int,
dbname varchar(100) null,
cmd varchar(20)
 
go
insert into spwhotbl exec sp_who
The table definition may need minor modifications when it comes to length and nullability of fields
July 21, 2005 at 8:50 am
Works perfectly! Thanks Jesper!
September 14, 2005 at 9:22 am
Although the following syntax will insert the results of the sp into a table, how can I append another value to the result set?
INSERT INTO tblTest EXEC sp_who
For example, if I had another column in tblTest that needed to be populated with lets say a custom value how can I amend the sql above to return the results of sp_who into tblTest as well as adding a custom value?
Thanks
September 15, 2005 at 1:18 am
Select results into tblTest as above, then copy everything to another table (with an extra column) while populating the extra column. I don't think there is an easier way...
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply