Table of Contents

Class SecuritySchema.DatabasePrincipal

Namespace
LinqToDB.Tools.DataProvider.SqlServer.Schemas
Assembly
linq2db.Tools.dll

sys.database_principals (Transact-SQL)

Applies to: √ SQL Server (all supported versions) √ Azure SQL Database √ Azure SQL Managed Instance √ Azure Synapse Analytics √ Analytics Platform System (PDW)

Returns a row for each security principal in a SQL Server database.


See sys.database_principals.

[Table(Schema = "sys", Name = "database_principals", IsView = true)]
public class SecuritySchema.DatabasePrincipal
Inheritance
SecuritySchema.DatabasePrincipal
Extension Methods

Properties

AllowEncryptedValueModifications

Applies to: SQL Server 2016 (13.x) and later, SQL Database.

Suppresses cryptographic metadata checks on the server in bulk copy operations. This enables the user to bulk copy data encrypted using Always Encrypted, between tables or databases, without decrypting the data. The default is OFF.

[Column("allow_encrypted_value_modifications")]
[NotNull]
public bool AllowEncryptedValueModifications { get; set; }

Property Value

bool

AuthenticationType

Applies to: SQL Server 2012 (11.x) and later.

Signifies authentication type. The following are the possible values and their descriptions.

0 : No authentication
1 : Instance authentication
2 : Database authentication
3 : Windows authentication
4 : Azure Active Directory authentication

[Column("authentication_type")]
[NotNull]
public int AuthenticationType { get; set; }

Property Value

int

AuthenticationTypeDesc

Applies to: SQL Server 2012 (11.x) and later.

Description of the authentication type. The following are the possible values and their descriptions.

NONE : No authentication
INSTANCE : Instance authentication
DATABASE : Database authentication
WINDOWS : Windows authentication
EXTERNAL: Azure Active Directory authentication

[Column("authentication_type_desc")]
[Nullable]
public string? AuthenticationTypeDesc { get; set; }

Property Value

string

CreateDate

Time at which the principal was created.

[Column("create_date")]
[NotNull]
public DateTime CreateDate { get; set; }

Property Value

DateTime

DefaultLanguageLcid

Applies to: SQL Server 2012 (11.x) and later.

Signifies the default LCID for this principal.

[Column("default_language_lcid")]
[Nullable]
public int? DefaultLanguageLcid { get; set; }

Property Value

int?

DefaultLanguageName

Applies to: SQL Server 2012 (11.x) and later.

Signifies the default language for this principal.

[Column("default_language_name")]
[Nullable]
public string? DefaultLanguageName { get; set; }

Property Value

string

DefaultSchemaName

Name to be used when SQL name does not specify a schema. Null for principals not of type S, U, or A.

[Column("default_schema_name")]
[Nullable]
public string? DefaultSchemaName { get; set; }

Property Value

string

IsFixedRole

If 1, this row represents an entry for one of the fixed database roles: db_owner, db_accessadmin, db_datareader, db_datawriter, db_ddladmin, db_securityadmin, db_backupoperator, db_denydatareader, db_denydatawriter.

[Column("is_fixed_role")]
[NotNull]
public bool IsFixedRole { get; set; }

Property Value

bool

ModifyDate

Time at which the principal was last modified.

[Column("modify_date")]
[NotNull]
public DateTime ModifyDate { get; set; }

Property Value

DateTime

Name

Name of principal, unique within the database.

[Column("name")]
[NotNull]
public string Name { get; set; }

Property Value

string

OwningPrincipalID

ID of the principal that owns this principal. All fixed Database Roles are owned by dbo by default.

[Column("owning_principal_id")]
[Nullable]
public int? OwningPrincipalID { get; set; }

Property Value

int?

PrincipalID

ID of principal, unique within the database.

[Column("principal_id")]
[NotNull]
public int PrincipalID { get; set; }

Property Value

int

SID

SID (Security Identifier) of the principal. NULL for SYS and INFORMATION SCHEMAS.

[Column("sid")]
[Nullable]
public byte[]? SID { get; set; }

Property Value

byte[]

TypeColumn

Principal type:

A = Application role

C = User mapped to a certificate

E = External user from Azure Active Directory

G = Windows group

K = User mapped to an asymmetric key

R = Database role

S = SQL user

U = Windows user

X = External group from Azure Active Directory group or applications

[Column("type")]
[NotNull]
public string TypeColumn { get; set; }

Property Value

string

TypeDesc

Description of principal type.

APPLICATION_ROLE

CERTIFICATE_MAPPED_USER

EXTERNAL_USER

WINDOWS_GROUP

ASYMMETRIC_KEY_MAPPED_USER

DATABASE_ROLE

SQL_USER

WINDOWS_USER

EXTERNAL_GROUPS

[Column("type_desc")]
[Nullable]
public string? TypeDesc { get; set; }

Property Value

string