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)
你可以通过上面这个语句,看看 那个表里面, 有没有其他额外的 Check。
或者通过下面的这个语句,查询 那个表上面, 有没有什么触发器 限制了你的操作。
select
tri.name AS TriggerName,
tri.is_disabled AS IsDisable,
tri.is_instead_of_trigger AS IsInsteadOfTrigger,
c.text AS CreateTriggerSQL
from
sys.triggers tri LEFT OUTER JOIN
dbo.syscomments c ON tri.object_id = c.id