How to retrieve a computer name and user name of a computer

How to retrieve a computer name and user name of a computer

Post by Tin L » Thu, 13 Jun 2002 00:02:18



Hi!
I would like to retrieve a computer name and user ID from a stored procedure
but do not know how.

Please help

Thank you.

Tin Le

 
 
 

How to retrieve a computer name and user name of a computer

Post by allen davidso » Thu, 13 Jun 2002 00:19:46


Hi Tin Le

Try these in query analyser


select user_name()
select current_user
select host_name()

Allen

Quote:>-----Original Message-----
>Hi!
>I would like to retrieve a computer name and user ID from
a stored procedure
>but do not know how.

>Please help

>Thank you.

>Tin Le

>.


 
 
 

How to retrieve a computer name and user name of a computer

Post by Tin L » Thu, 13 Jun 2002 00:55:44


Thank you Allen,

Yes! That is what I needed.

I have added a new one

Select (suser_sname())

to get UserID too

Thank again.

Tin Le


> Hi Tin Le

> Try these in query analyser


> select user_name()
> select current_user
> select host_name()

> Allen

> >-----Original Message-----
> >Hi!
> >I would like to retrieve a computer name and user ID from
> a stored procedure
> >but do not know how.

> >Please help

> >Thank you.

> >Tin Le

> >.

 
 
 

How to retrieve a computer name and user name of a computer

Post by linda deng[M » Fri, 14 Jun 2002 16:36:13


Hi Tin,

        You can try these sample codes:
        select HOST_ID()     or      select HOST_NAME()

        select SYSTEM_USER  or select SUSER_SID() or select SUSER_SNAME()

        select USER_NAME()    or   select USER_ID()

        If anything is unclear please let me know.

Sincerely,

Linda Deng
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.