Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing dbname in result set from sp_who.

Status
Not open for further replies.

AWEinCA

Programmer
Oct 18, 2000
35
US
If I want to loop through a sp_who result set, how would I look at what database a user is logged into?

Syntax???

while sp_who
Begin
if (sp_who.dbname = 'testdb')
.
.
.
END [sig][/sig]
 
NO, try using insert/exec and insert the results from sp_who into a temp table, then use a cursor to process the results...

Tom [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top