Re: Login name in integrated security

From: Sue Hoegemeier (Sue_H_at_nomail.please)
Date: 09/28/04


Date: Mon, 27 Sep 2004 21:24:36 -0600

You can use Is_Member to find if a user is a member of a
Windows group.
You can get a list of Windows groups using xp_logininfo.

-Sue

On Thu, 23 Sep 2004 13:02:57 -0700, "John Beatty"
<johnb@bigfootsoftware.com> wrote:

>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
>
>
>



Relevant Pages

  • Login account name in group-level integrated security
    ... I want to list the DB Roles I currently am a member of, ... and associating all SQL Server Login ... the SQL Server Login account when I'm logged in as a member of an NT group ... where uid = SUSER_SID ...
    (microsoft.public.sqlserver.programming)
  • Login name in integrated security
    ... I want to list the DB Roles I currently am a member of, ... and associating all SQL Server Login ... the SQL Server Login account when I'm logged in as a member of an NT group ... where uid = SUSER_SID ...
    (microsoft.public.sqlserver.security)
  • RE: Deployment Log --Unspecified exception: Access is denied.
    ... It doesn't matter if your login account is a member of local Administrators group. ... The purpose of other BizTalk groups are documented. ...
    (microsoft.public.biztalk.general)