Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_srvrolepermission

  No additional text.


Syntax
create procedure sys.sp_srvrolepermission
	@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 distinct 'ServerRole' = l.name, 'Permission' = p.name collate database_default
			from sys.server_principals l, sys.role_permissions p
			where l.name = @srvrolename and p.low > 0 and
				  ((p.type = 'SRV' and (p.number = l.principal_id or l.principal_id = suser_id('sysadmin'))) or
				  (p.type = 'DBR' and l.principal_id = suser_id('sysadmin') and not (p.name like N'No %')))
			order by l.name, p.name collate database_default
	end
	else
	begin
		-- RESULT SET FOR ALL SERVER-ROLES
		select distinct 'ServerRole' = l.name, 'Permission' = p.name collate database_default
			from sys.server_principals l, sys.role_permissions p
			where p.low > 0 and
				((p.type = 'SRV' and (p.number = l.principal_id or l.principal_id = suser_id('sysadmin'))) or
				  (p.type = 'DBR' and l.principal_id = suser_id('sysadmin') and not (p.name like N'No %')))
			order by l.name, p.name collate database_default
	end

    return (0) -- sp_srvrolepermission

 
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