Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sysusers

  No additional text.


Syntax
-- Note: gid (max group id) not maintained, shiloh logic not correct anyway

CREATE VIEW sys.sysusers AS
	SELECT uid = convert(smallint, u.id),
		status = convert(smallint, case u.type
			when 'U' then 12 when 'G' then 4 when 'A' then 32
			when 'L' then 16 + (u.status & 1)*12 else 0 end),
		u.name, u.sid,
		roles = convert(varbinary(2048), null),
		createdate = u.created,
		updatedate = u.modified,
		altuid = convert(smallint, r.indepid),
		password = convert(varbinary(256), null),
		gid = convert(smallint, case u.type when 'R' then u.id else 0 end),
		environ = convert(varchar(255), null),
		hasdbaccess = convert(int, case when p.state in ('G','W') then 1 else 0 end),
		islogin = convert(int, case u.type when 'A' then 0 when 'R' then 0 else 1 end),
		isntname = convert(int, case u.type when 'U' then 1 when 'G' then 1
			when 'L' then (u.status & 1) else 0 end),	-- USR_SID_EXTERNAL
		isntgroup = convert(int, case u.type when 'G' then 1 else 0 end),
		isntuser = convert(int, case u.type when 'U' then 1 when 'L' then (u.status & 1) else 0 end),	-- USR_SID_EXTERNAL
		issqluser = convert(int, case u.type when 'S' then 1 else 0 end),
		isaliased = convert(int, case u.type when 'L' then 1 else 0 end),
		issqlrole = convert(int, case u.type when 'R' then 1 else 0 end),
		isapprole = convert(int, case u.type when 'A' then 1 else 0 end)
	FROM sys.sysowners u
	LEFT JOIN sys.sysprivs p ON p.class = 0 AND p.id = 0 AND p.subid = 0 AND p.grantee = u.id AND p.grantor = 1 AND p.type = 'CO'
	LEFT JOIN sys.syssingleobjrefs r ON r.depid = u.id AND r.depsubid = 0 AND r.class = case u.type when 'R' then 51 when 'L' then 72 end -- SRC_ROLEOWNER, SRC_ALIASUSER
	WHERE has_access('US', u.id) = 1

 
Last revision 2008RTM
See also

  sp_addalias (Procedure)
sp_adddistributiondb (Procedure)
sp_adduser (Procedure)
sp_changeobjectowner (Procedure)
sp_change_users_login (Procedure)
sp_check_for_owned_jobsteps (Procedure)
sp_check_removable (Procedure)
sp_check_removable_sysusers (Procedure)
sp_dropalias (Procedure)
sp_dropuser (Procedure)
sp_get_jobstep_db_username (Procedure)
sp_helplogins (Procedure)
sp_helpntgroup (Procedure)
sp_helprolemember (Procedure)
sp_help_publication_access (Procedure)
sp_MSadduser_implicit_ntlogin (Procedure)
sp_MSdbuserpriv (Procedure)
sp_MSloginmappings (Procedure)
sp_resolve_logins (Procedure)
sp_tables (Procedure)
sp_verify_jobstep (Procedure)
       



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