sp_who does more than a simple select of sysprocesses, so the select is
faster... but I don't think the time difference will be signficant.
You can see how to get the info you describe if you look at the code in
sp_who to see where it grabs it's data from. You could always write a custom
version.... you can look at the text of sp_who directly from SQL EM. It's
in the master DB.
Solid Quality Learning
SQL Server MVP
"Ricky" <ricky.arorametc.state.mn.us> wrote in message
news:005901c347b9$87369910$a101280aphx.gbl...> I want to get the user login name and host name for any
> user who is accesing the databases thru enterprise
> manager. I found out I can execute sp_who with spid as
> parameter and I get back result as a select statement
> I want to know how can I concatenate loginname and
> hostname field together and store in a variable in a
> select statement or do I have to create a function and
> store the result in a table and access the table via
> select ???
> Other question is is it faster to execute sp_who to get
> the above said information inside a trigger or do a select
> directly into sysprocesses table.
> select LoginName = rtrim(loginame), HostName = rtrim
> from master.dbo.sysprocesses
> where spid = SPID
> Thanks for help.