DELETE RECORDS REGARDLESS FOREIGN KEYS

DELETE RECORDS REGARDLESS FOREIGN KEYS

Post by Alber » Thu, 08 Nov 2001 18:01:36



Hi,
in SQL 6.5 is there a way to  delete all record in a table (using
DELETE * FROM or TRUNCATE) regardless of the foreign keys ?
I want to delete some tables WITHOUT CHECK of the foreign keys !!

Thakns

 
 
 

DELETE RECORDS REGARDLESS FOREIGN KEYS

Post by BP Margoli » Fri, 09 Nov 2001 01:24:34


Alberto,

You can check whether the SQL Server 6.5 ALTER TABLE command has an option
to disable FOREIGN KEY constraints ... I don't believe it does, but I
haven't used SQL Server 6.5 in a long time.

Other than disabling the constraint, if it is supported in SQL Server 6.5,
or dropping the constraint, there is no way to delete rows regardless of the
FOREIGN KEY constraint. To do so, would undermine the very purpose of
establishing a FOREIGN KEY constraint in the first place.

-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.


Quote:> Hi,
> in SQL 6.5 is there a way to  delete all record in a table (using
> DELETE * FROM or TRUNCATE) regardless of the foreign keys ?
> I want to delete some tables WITHOUT CHECK of the foreign keys !!

> Thakns