sql中如何查看已定义表的完整性约束
发布网友
发布时间:2023-08-06 08:43
我来回答
共1个回答
热心网友
时间:2024-12-05 05:38
SQL Server 2008 下可用
SELECT
tab.name AS [表名],
chk.name AS [Check约束名],
col.name AS [列名],
chk.definition
FROM
sys.check_constraints chk
JOIN sys.tables tab
ON (chk.parent_object_id = tab.object_id)
JOIN sys.columns col
ON (chk.parent_object_id = col.object_id
AND chk.parent_column_id = col.column_id)
追问恩恩 懂了 、太细心了、虽然还看不懂 不过很正确、