Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sp_who

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-29 : 12:13:44
Jose writes "I am trying to put the sp_who result into a table or cursor but I do not know how could I do it.

Thank you

Jose"

skillile
Posting Yak Master

208 Posts

Posted - 2001-12-29 : 13:50:42
create table #t (
field1 varchar(50),
field2 varchar(50),
field3 varchar(50),
field4 varchar(50),
field5 varchar(50),
field6 varchar(50),
field7 varchar(50),
field8 varchar(50)
)
--make the fields the correct datatype and length
--but this should do the trick

insert #t
exec sp_who

select * from #t
drop table #t


slow down to move faster...
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2001-12-29 : 15:02:36
You could also look at sp_who and pick out the values that you need and use those rather than running the whole SP.

An example of doing this with some extra features is at
www.nigelrivett.com
sp_nrlocks

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -