QOD 13/10/2003

  • Maybe spent one thought too much on the QOD today... but I don't think that by using an ALTER TABLE statement you achieve a *temporary* solution. As long as you don't use another ALTER TABLE statement to set the CHECK option on again after inserting, it is persistent in my view.

  • I have to agree. The way the question was worded, and the answers given, I answered there was no way to temporarily disable foreign keys.

    It would have been better to place teh answer in the form of:

    ALTER TABLE CustomerHistory NOCHECK CONSTRAINT all

    GO

    Insert Into(...)

    GO

    ALTER TABLE CustomerHistory CHECK CONSTRAINT all

    (or however the reverse would be)

  • You did not spend one too many thoughts - This one was poorly worded and incorrect. My first instinct was was nocheck, but the *temporary* word is the key.

    <RANT> ALTER TABLE IS NOT TEMPORARY </RANT>

    It may be used as a temporary solution if paired with other TSQL, as cliffb pointed out, but as stated, I do not see where there is any *temporary* one-line solution to the stated problem. If this db were to left in this state, referential integrity is out the door.

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

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