标签: sql foreign-key-relationship
我有获取所有约束名称的SQL查询,但不确定如何获取其状态,如是否启用/禁用?
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint, SCHEMA_NAME(schema_id) AS SchemaName, OBJECT_NAME(parent_object_id) AS TableName, type_desc AS ConstraintType,* FROM sys.objects
任何帮助?
答案 0 :(得分:2)
使用OBJECTPROPERTY(OBJECT_ID('FK_foo_bar', 'CnstIsDisabled')
OBJECTPROPERTY(OBJECT_ID('FK_foo_bar', 'CnstIsDisabled')
OR
使用包含“is_disabled”列