Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_helpsrvrolemember

  No additional text.


Syntax
create procedure sys.sp_helpsrvrolemember
	@srvrolename       sysname = NULL
AS
	if @srvrolename is not null
	begin
		-- VALIDATE GIVEN NAME
		if not exists (select * from sys.server_principals
				where name = @srvrolename and principal_id >= suser_id('sysadmin') and principal_id <= suser_id('bulkadmin'))
		begin
			raiserror(15412, -1, -1, @srvrolename)
			return (1)
		end

		-- RESULT SET FOR SINGLE SERVER-ROLE
		select 'ServerRole' = SUSER_NAME(rm.role_principal_id), 'MemberName' = lgn.name , 'MemberSID' = lgn.sid
			from sys.server_role_members rm, sys.server_principals lgn
			where rm.role_principal_id = SUSER_ID(@srvrolename) AND
				  rm.member_principal_id = lgn.principal_id
	end
	else
	begin
		-- RESULT SET FOR ALL FIXED SERVER-ROLES
		select 'ServerRole' = SUSER_NAME(rm.role_principal_id), 'MemberName' = lgn.name, 'MemberSID' = lgn.sid
			from sys.server_role_members rm, sys.server_principals lgn
			where rm.role_principal_id >=3 AND rm.role_principal_id <=10 AND
				  rm.member_principal_id = lgn.principal_id
	end

    return (0) -- sp_helpsrvrolemember

 
Last revision 2008RTM
News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash