Situatie
Procedura de mai jos returneaza toti userii ce sunt asignati unui rol de server, pe serverul de sql.
Solutie
create procedure GetAllUsersOnServerRoles_prc
as
select su.name,p.name
from sys.server_principals P
JOIN sys.server_role_members sr
On P.principal_id = sr.role_principal_id
JOIN (Select sr.Name,p.principal_id from sys.syslogins sr
JOIN sys.server_principals p
On P.sid = sr.sid)su
On sr.member_principal_id = su.principal_id
Leave A Comment?