Foreign Keys - Truncate Table RRS feed

  • Question

  • Hi,

    if you use foreign keys with tables you can't use truncate table anymore... Is this right in all cases? I need foreign keys only for "illustration", so that database diagrams can be build and other tools find out about links between tables. I need no contstraints at all. On the other hand I'm dealing with quite a bunch of data and I have to clear up big tables, so using truncate table would speed up my work significantly...

    Is there any way to benefit from foreing keys but not to suffer from limitations like using delete instead of truncate?


    Tuesday, February 14, 2006 12:33 PM


  • If you truncate the tables in a batch you can drop the constraint for truncating and recreate them afterwards. With the FK you can´t use the truncate statement.

    HTH, Jens Suessmeyer.

    Tuesday, February 14, 2006 1:52 PM