Home > Archive > MS SQL Server > March 2006 > truncate table error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author truncate table error
Hong Wang

2006-03-09, 8:23 pm

Hi,

I have two tables, these two tables has a foreign key constaint, and I want
to truncate both of them. I first truncate the child table with no problem (
the table has 0 rows now). But when I try to truncate the parent table, I got
a foreign key integrity error. I disable the foreign key constraint, and
truncate the parent table again, still the same error, then I run a delete
command, no error. Why can't I truncate the parent table even after I disable
the foreign key constraint?

Thanks for help.
Sue Hoegemeier

2006-03-10, 3:23 am

It's still not allowed even if you disable the foreign key
constraint. You need to drop the foreign key to truncate the
table.

-Sue

On Thu, 9 Mar 2006 13:15:28 -0800, Hong Wang <Hong
Wang@discussions.microsoft.com> wrote:

>Hi,
>
>I have two tables, these two tables has a foreign key constaint, and I want
>to truncate both of them. I first truncate the child table with no problem (
>the table has 0 rows now). But when I try to truncate the parent table, I got
>a foreign key integrity error. I disable the foreign key constraint, and
>truncate the parent table again, still the same error, then I run a delete
>command, no error. Why can't I truncate the parent table even after I disable
>the foreign key constraint?
>
>Thanks for help.


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com