February 18, 2005 at 5:20 am
Trying to clear out a dev database, which has many FK constraints
I have disabled all foreign key constraints on all user tables in db
but truncating certain tables fails because of foreign key constraint ( even through I can delete all data in the tables and reseed the indenity )
Anybody know why it complains about Foreign Key constraints even though they have been disabled.
(I dont want to recreate the db from script because I have a DB Diagram which I want to keep - recreating the db from script will lose me my diagram).
February 18, 2005 at 5:51 am
Have you tried truncating the child tables first and then the parents?
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
February 18, 2005 at 5:55 am
All The tables were empty .
I could delete the tables and reseed them - but I could not truncate them - even though the FK Constraints were off.??
February 18, 2005 at 2:44 pm
FROM BOL:
-------------------------------------------------------
Disabling FOREIGN KEY Constraints
Existing FOREIGN KEY constraints can be disabled for:
.............
...........
------------------------------------------------------
Therefore they can't be disabled for TRUNCATE TABLE operations, you will have to remove the FK
HTH
* Noel
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply