Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Disable constraints temporarily


Message #1 by mike.harte@f... on Fri, 27 Apr 2001 10:47:28
Mike,

The Alter Table command has a clause that allows you to disable and enable a
constraint.

-- Disable the constraint and insert record that violates constraint.
ALTER TABLE cnst_example NOCHECK CONSTRAINT salary_cap
INSERT INTO cnst_example VALUES (3,"Pat Jones",105000)

-- Reenable the constraint and try another insert, will fail.
ALTER TABLE cnst_example CHECK CONSTRAINT salary_cap
INSERT INTO cnst_example VALUES (4,"Eric James",110000)


Jeff Wilson
The Boolean Group, Inc.

<mike.harte@f...> wrote in message news:60561@s..._language...
>
> Hi,
>
> Can anyone help?
>
> Is there a simple command prior to executing a TSQL script that will
> drop fk constraints temporarily so I can easily do deletes/truncates on a
> series of joined tables which I want to clear/reset the identity columns
> on?
>
> Thanks
>
> Mike H.
>
>



  Return to Index