November 28, 2009 at 3:10 am
Access to SQL Server is restricted by logins associated with Windows Groups.
Both server-roles and database-users are assigned to the Windows group logins.
However, when a user logs in, the USER_ and SUSER_ name and ID functions return the Windows account name of the user.
Therefore, how do I determine the roles associated with that user when only the windows groups exist within the role/principal maps?
November 28, 2009 at 4:50 am
select * from sys.syslogins
Hope this query give you your desire result.
it contain all log in name role associated with log in name,
try it
November 29, 2009 at 9:46 am
December 1, 2009 at 2:14 am
Try this example taken rom BOL ---> IS_SRVROLEMEMBER (Transact-SQL)
IF IS_SRVROLEMEMBER ('sysadmin') = 1
print 'Current user''s login is a member of the sysadmin role'
ELSE IF IS_SRVROLEMEMBER ('sysadmin') = 0
print 'Current user''s login is NOT a member of the sysadmin role'
ELSE IF IS_SRVROLEMEMBER ('sysadmin') IS NULL
print 'ERROR: The server role specified is not valid.'
...for each server role.
December 2, 2009 at 6:00 am
dmoldovan (12/1/2009)
Try this example taken rom BOL ---> IS_SRVROLEMEMBER (Transact-SQL)IF IS_SRVROLEMEMBER ('sysadmin') = 1
print 'Current user''s login is a member of the sysadmin role'
ELSE IF IS_SRVROLEMEMBER ('sysadmin') = 0
print 'Current user''s login is NOT a member of the sysadmin role'
ELSE IF IS_SRVROLEMEMBER ('sysadmin') IS NULL
print 'ERROR: The server role specified is not valid.'
...for each server role.
Thank you. This solves my problem.
December 2, 2009 at 6:49 am
You're welcome 🙂
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply