foreign keys

  • When doing some upload of data, there are sometimes issues of forign key constraints.

    So I need to drop them and load the data then recreate them.

    But I find another option , is to disable and enable

    What is the better option

    To use disable and enable vs drop and recreate ?

  • Better option would be to load data into the parent tables first and ensure that you won't get an FK violation error when loading the child tables.

    That said - either of those methods are fine so long as you remember to re-enable/re-create the FK.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Ya but you still have to revalidate ALL the data in the table so that the constrain STAY trusted. If not they lose their hability to short-circuit some sql statement when optimizing.

    So i fyou only reload part of the data you're better off just leaving them there rather than revalidating 100% of the rows (9)% of which had already been validated)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply