Login account name in group-level integrated security
From: John Beatty (johnb_at_bigfootsoftware.com)
Date: 09/23/04
- Next message: Richard J: "RE: Dymanic ORder Statement - Passed Parameter"
- Previous message: Vishal Parkar: "Re: Trigger not quite right"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 23 Sep 2004 11:54:47 -0700
Hi All -
I want to list the DB Roles I currently am a member of, when I'm an NT Login
that is a member of an NT Group that is associated to an SQL Server Login
account.
When using integrated security, and associating all SQL Server Login
accounts to NT Group accounts, how do you get the master.syslogins.name of
the SQL Server Login account that is associated to the NT Group that is
currently being used?
I've tried the following, and more, to no avail. I just want the name of
the SQL Server Login account when I'm logged in as a member of an NT group
that is assigned to the SQL Login account. All I seem to get is the name of
the NT Login account, which is useful, but not what I want.
select name from master..syslogins
where master.dbo.fn_varbintohexstr(sid) = SUSER_SID(SUSER_SNAME())
. . . is close, but no cigar.
Thanks,
John
------
set nocount on
select SYSTEM_USER
select CURRENT_USER
select SESSION_USER
select USER
select USER_NAME()
select SUSER_SNAME()
select USER_ID()
select SUSER_SID()
select USER_NAME(USER_ID())
select SUSER_SNAME(SUSER_SID())
select USER_ID(USER_NAME())
select SUSER_SID(SUSER_SNAME())
select name from master..syslogins
where master.dbo.fn_varbintohexstr(sid) = SUSER_SID(SUSER_SNAME())
select name from sysusers
where uid = SUSER_SID()
select name from sysusers
where uid = USER_ID()
declare @UserName sysname set @UserName = USER_NAME()
declare @s varchar (1000) set @s = 'exec sp_helpuser ''' + @UserName + ''''
execute (@s)
set nocount off
- Next message: Richard J: "RE: Dymanic ORder Statement - Passed Parameter"
- Previous message: Vishal Parkar: "Re: Trigger not quite right"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|