isakhnov (4/5/2010)
I see. I can use xp_logininfo to get to the login used for the session, thanks!Do you know how bad is the performance? Original implementation was retrieving this info from the sys.login_token but we had to drop it due to the terrible performance.
Same mechanism as far as I know. Not really my area, but my guess is that SQL Server has to contact Active Directory/ a domain controller via a call to Windows to populate sys.login_token.
sys.login_token and xp_logininfo are only really designed for diagnostics and trouble-shooting. If you need to check membership of a Windows group in a production application, use the IS_MEMBER built-in function.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi