There are scenarios, where we need to find the logged in user. In that case, you can use the below sql builtin functions to identify the logged in users.
select host_name()
Above command is used to find the logged in user in a network. Here Venkat is the host name. Machine connected to the sql server in the network.

select suser_sname()
In our example, suba is the user "logged in" into the server.
An alternative command to fetch the logged in user.
select system_user


sp_who2 is an alternative command of sp_who. sp_who2 will provide you more options when compared to sp_who command.

Thanks and Regards,
Venkatesan Prabu .J
No comments:
Post a Comment