sys.default_constraints (Transact-SQL)sys.default_constraints (Transact-SQL)
Anwendungsbereich:Applies to: SQL ServerSQL Server (alle unterstützten Versionen)
SQL ServerSQL Server (all supported versions)
Azure SQL-DatenbankAzure SQL Database
Azure SQL-DatenbankAzure SQL Database
Verwaltete Azure SQL-InstanzAzure SQL Managed Instance
Verwaltete Azure SQL-InstanzAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
SQL ServerSQL Server (alle unterstützten Versionen)
SQL ServerSQL Server (all supported versions)
Azure SQL-DatenbankAzure SQL Database
Azure SQL-DatenbankAzure SQL Database
Verwaltete Azure SQL-InstanzAzure SQL Managed Instance
Verwaltete Azure SQL-InstanzAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
Enthält eine Zeile für jedes Objekt, bei dem es sich um eine Standard Definition handelt (wird als Teil einer CREATE TABLE-oder ALTER TABLE-Anweisung anstelle einer CREATE DEFAULT-Anweisung erstellt), mit sys. Objects. Type = D.Contains a row for each object that is a default definition (created as part of a CREATE TABLE or ALTER TABLE statement instead of a CREATE DEFAULT statement), with sys.objects.type = D.
SpaltennameColumn name | DatentypData type | BeschreibungDescription |
---|---|---|
<Columns inherited from sys.objects> | Eine Liste der Spalten, die diese Sicht erbt, finden Sie unter sys. Objects (Transact-SQL-).For a list of columns that this view inherits, see sys.objects (Transact-SQL). | |
parent_column_idparent_column_id | intint | ID der Spalte in parent_object_id , zu der dieser Standard gehört.ID of the column in parent_object_id to which this default belongs. |
Definitiondefinition | nvarchar(max)nvarchar(max) | SQL-Ausdruck, der diesen Standard definiertSQL expression that defines this default. |
is_system_namedis_system_named | bitbit | 1 = Der Name wurde vom System generiert.1 = Name was generated by system. 0 = Der Name wurde vom Benutzer angegeben.0 = Name was supplied by the user. |
BerechtigungenPermissions
Die Sichtbarkeit der Metadaten in Katalogsichten ist auf sicherungsfähige Elemente eingeschränkt, bei denen der Benutzer entweder der Besitzer ist oder für die dem Benutzer eine Berechtigung erteilt wurde.The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. Weitere Informationen finden Sie unter Metadata Visibility Configuration.For more information, see Metadata Visibility Configuration.
BeispieleExamples
Im folgenden Beispiel wird die Definition der DEFAULT-Einschränkung zurückgegeben, die auf die VacationHours
-Spalte der HumanResources.Employee
-Tabelle angewendet wird.The following example returns the definition of the DEFAULT constraint that is applied to the VacationHours
column of the HumanResources.Employee
table.
USE AdventureWorks2012;
GO
SELECT d.definition
FROM sys.default_constraints AS d
INNER JOIN sys.columns AS c
ON d.parent_object_id = c.object_id
AND d.parent_column_id = c.column_id
WHERE d.parent_object_id = OBJECT_ID(N'HumanResources.Employee', N'U')
AND c.name = 'VacationHours';
Weitere InformationenSee Also
Katalogsichten für Objekte (Transact-SQL) Object Catalog Views (Transact-SQL)
Katalogsichten (Transact-SQL) Catalog Views (Transact-SQL)
FAQ: Abfragen des SQL Server-SystemkatalogsQuerying the SQL Server System Catalog FAQ