Retrieving windows authentication details | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Retrieving windows authentication details

If you use windows authentication for you connection details is there a way to obtain the user login name in sql server for that connection eg in the stored procs you want to add audit details including the logged on user but don’t want to pass it into the procedure but have a generic function that will return it? Cheers World Domination Through Superior Software
No problem found it : select nt_username from master.dbo.sysprocesses where spid = @@spid Thanks
World Domination Through Superior Software
Or you can use select system_user This gives you the same thing without having to go to sysprocesses. Tom Pullen
DBA, Oxfam GB
]]>