使用此查询,我已经能够获取SQL Server数据库的约束列表,但我不知道如何在此结果中添加相关字段。
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
ORDER BY type_desc;
我希望看到每个约束所涉及的字段名称。
例如: NameofConstraint:FK_SURVEY_IDSURVEY, TableName:调查, ConstraintType:FOREIGN_KEY_CONSTRAINT, ConcernedField:IDSURVEY
有人能帮助我吗?
非常感谢:)