Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_helpntgroup

  No additional text.


Syntax
create procedure sys.sp_helpntgroup
	@ntname       sysname = NULL
AS
	if @ntname is not null
	begin
		-- VALIDATE GIVEN NAME
		if not exists (select * from sysusers where name = @ntname and isntgroup = 1)
		begin
			raiserror(15420, -1, -1, @ntname)
			return (1)
		end

		-- RESULT SET FOR SINGLE GROUP
		select 'NTGroupName' = u.name, 'NtGroupId' = u.principal_id, 'SID' = u.sid, 'HasDbAccess' = case when p.state in ('G','W') then 1 else 0 end
			from sys.database_principals u
			left join sys.database_permissions p on p.class = 0 and p.major_id = 0 and p.minor_id = 0
				and p.grantee_principal_id = u.principal_id AND p.grantor_principal_id = 1 AND p.type = 'CO'
			where u.name = @ntname and u.type = 'G'
	end
	else
	begin
		-- RESULT SET FOR ALL GROUPS
		select 'NTGroupName' = u.name, 'NtGroupId' = u.principal_id, 'SID' = u.sid, 'HasDbAccess' = case when p.state in ('G','W') then 1 else 0 end
			from sys.database_principals u
			left join sys.database_permissions p on p.class = 0 and p.major_id = 0 and p.minor_id = 0
				and p.grantee_principal_id = u.principal_id AND p.grantor_principal_id = 1 AND p.type = 'CO'
			where u.type = 'G'
	end

	return (0) -- sp_helpntgroup

 
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