Re: Truncate table being referenced by a foriegn key

From: Roji. P. Thomas (lazydragon_at_nowhere.com)
Date: 03/03/04


Date: Wed, 3 Mar 2004 17:07:53 +0530

First you have to drop the foreign key constraints
or U have to use the

DELETE FROM table Syntax

-- 
Roji. P. Thomas
SQL Server Programmer
"Abhishek Srivastava" <abhishek-srivastava@nospam.net> wrote in message
news:OG0T9MRAEHA.688@tk2msftngp13.phx.gbl...
> Hello All,
>
> When I try to truncate the tables in my database I get error message
>
> Cannot truncate table 'bt_Bug' because it is being referenced by a
> FOREIGN KEY constraint.
>
> How can I truncate all the tables I tried to do this in many possible
> order of all tables... but I get this error always for one table or other.
>
> Thanks for your help in advance.
>
> regards,
> Abhishek.
>


Relevant Pages

  • Re: Truncate table being referenced by a foriegn key
    ... First you have to drop the foreign key constraints ... "Abhishek Srivastava" wrote in message ... > When I try to truncate the tables in my database I get error message> ... > Cannot truncate table 'bt_Bug' because it is being referenced by a> FOREIGN KEY constraint. ...
    (microsoft.public.sqlserver.programming)
  • Re: Identity
    ... If you also want to remove data, you can use TRUNCATE table as long as the ... table has no foreign key constraints. ... SQL Server MVP ... > How do you reset or reseed the IDENTITY column? ...
    (microsoft.public.sqlserver.programming)
  • Re: how to boost drop table statement
    ... > You could try to TRUNCATE the tables first, but then they must not have ... > foreign key constraints. ... John ... Prev by Date: ...
    (comp.lang.java.databases)