如何启用所有CONSTRAINT?

时间:2015-01-27 17:30:37

标签: sql sql-server

我的表:

CREATE TABLE sales
(ord INTEGER NOT NULL,
ship INTEGER NOT NULL);
ALTER TABLE sales
ADD CONSTRAINT order_check CHECK(ord < 10);

然后我停用了CONSTRAINT

ALTER TABLE sales NOCHECK CONSTRAINT ALL;
INSERT INTO sales VALUES(10,1)

SELECT * FROM sales

如何启用我的所有CONSTRAINT

3 个答案:

答案 0 :(得分:2)

你试过吗

ALTER TABLE sales CHECK CONSTRAINT ALL;

答案 1 :(得分:2)

MSDN doc

ALTER TABLE sales CHECK CONSTRAINT ALL;

答案 2 :(得分:1)

CHECK

ALTER TABLE sales CHECK CONSTRAINT ALL;