Worked OK for me:drop table T100godrop view VT100goCreate table T100 (A int)GOCreate view VT100 AS (SELECT * FROM T100 WHERE A < 2) with check optionGOINSERT INTO T100 VALUES (1) -- Part of the view's result INSERT INTO T100 VALUES (2) GOSELECT * FROM VT100 -- SHOWS 1GOINSERT INTO VT100 VALUES (-2) -- WorksGOUPDATE VT100 SET A=5 -- Update fails because of WITH CHECK OPTION - GOODGOINSERT INTO VT100 VALUES (999) -- Inser fails because of WITH CHECK OPTION - GOODGODELETE FROM VT100 -- DELETES ALL ROWS!!!! ******************* ???goprint 'Select from T100'SELECT * FROM T100 -- Still has one row
Results:(1 row(s) affected)(1 row(s) affected)A ----------- 1(1 row(s) affected)(1 row(s) affected)Server: Msg 550, Level 16, State 1, Line 1The attempted insert or update failed because the target view either specifies WITH CHECK OPTION or spans a view that specifies WITH CHECK OPTION and one or more rows resulting from the operation did not qualify under the CHECK OPTION constraint.The statement has been terminated.Server: Msg 550, Level 16, State 1, Line 1The attempted insert or update failed because the target view either specifies WITH CHECK OPTION or spans a view that specifies WITH CHECK OPTION and one or more rows resulting from the operation did not qualify under the CHECK OPTION constraint.The statement has been terminated.(2 row(s) affected)Select from T100A ----------- 2(1 row(s) affected)
CODO ERGO SUM