Dear All, Using select user_name() always return dbo. But I wanted the loginID. How to get the user's LoginID using T-SQL? Thanks
--list all logins from a server select name,loginname from master.dbo.syslogins --list all logins connected to sql server. you have to query sysprocesses table and syslogins and join. check BOL
My Site:http://www.mssqlengineering.com My Book:http://www.wiley.com/WileyCDA/WileyT...470477288.html
/* information about the current user */ --server level (login) select system_user , suser_sname() , suser_sid() --db level (db user) select session_user , current_user , user , user_name() , user_id()
You Have To Be Happy With What You Have To Be Happy With (KC)
Forum Rules