Re: Login name in integrated security
From: Sue Hoegemeier (Sue_H_at_nomail.please)
Date: 09/28/04
- Next message: Sunil Vakharia: "RE: How to avoid giving system admin rights database admin?"
- Previous message: Adam Machanic: "Re: Password does not work on SQL Server 2000"
- In reply to: John Beatty: "Login name in integrated security"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
>
>
>
- Next message: Sunil Vakharia: "RE: How to avoid giving system admin rights database admin?"
- Previous message: Adam Machanic: "Re: Password does not work on SQL Server 2000"
- In reply to: John Beatty: "Login name in integrated security"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|