检查约束违反了sql错误发生

时间:2014-05-17 05:16:39

标签: sql

ADD CONSTRAINT CK_SPLFEATURES CHECK ((special_features ='Trailers') OR(special_features ='Commentaries') OR(special_features ='Deleted Scenes') OR(special_features ='Behind the Scenes'));

检查违反的约束

我得到了这个错误,它适用于其他东西但不是这个

1 个答案:

答案 0 :(得分:1)

我假设您有一些违反约束的数据。你可以通过否定表达来找出答案:

select ... from T 
where not (
   (special_features ='Trailers') OR(special_features ='Commentaries')
 OR(special_features ='Deleted Scenes') OR(special_features ='Behind the Scenes')
);