If you need name of the Windows group that allowed you to connect:
==================================================================
If you need name of the Windows group that allowed the user to connect, take
a look at xp_logininfo and the 'mapped user name' column in the result.
You'll need to insert the results into a table like the example below if you
need a scalar result. See xp_logininfo in the Books Online for permission
requirements.
-------------------------------------------:
http://www.megasolutions.net/Sqlserver/Using-suser_id()-and-sys_server_principals-when-connecting-through-a-windows-group-7608.aspx
SET NOCOUNT ON
DECLARE
@me sysname,
@permission_path sysname
SET @me = SUSER_SNAME()
CREATE TABLE #LoginInfo
(
account_name sysname,
logintype char(8),
privilege char(9),
mapped_login_name sysname,
permission_path sysname
)
INSERT INTO #LoginInfo
EXEC xp_logininfo @me
SELECT @permission_path = permission_path
FROM #LoginInfo
DROP TABLE #LoginInfo
SELECT @permission_path
GO
Posts tonen met het label Discover the name of the Windows group that allowed you to connect. Alle posts tonen
Posts tonen met het label Discover the name of the Windows group that allowed you to connect. Alle posts tonen
donderdag 27 november 2008
Abonneren op:
Posts (Atom)