update script does not contain FK

Brian DonahueBrian Donahue Posts: 6,590 New member
"HVE" <[email protected]> wrote in message
news:[email protected]
> Hi,
>
> it looks like SDC forgets to take FK constraints into account when
> synchronizing tables on two servers. The following is part of the proposed
> script :
>
> Note that this script will carry out all DELETE commands for all tables
> first, then all the UPDATES and then all the INSERTS
> It will disable foreign key constraints at the beginning of the script,
and
> re-enable them at the end
> */
> SET XACT_ABORT ON
> SET ARITHABORT ON
> GO
> -- Pointer used for text / image updates. This might not be needed, but is
> declared here just in case
> DECLARE @ptrval binary(16)
>
> BEGIN TRANSACTION
> DELETE FROM .....
>
> It references the FK constraints, but they are not in there.
> small bug?
>
> Best Regards
>
> Hans

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Hans,

    When Data Compare generates a SQL script for one table, it does not take
    into consideration a foreign key constraint imposed on it by another table.
    For instance, if I want to migrate table A, which has an FK constraint
    referencing it from table B, Data Compare will only add the ALTER TABLE
    NOCHECK CONSTRAINT if I am scripting table A and B together. If I select
    only table A for migration, the script will not disable the foreign key and
    a failure might happen running the script.

    Yours,

    Brian Donahue
    Red Gate Technical Support

    "HVE" <[email protected]> wrote in message
    news:[email protected]
    > Hi,
    >
    > it looks like SDC forgets to take FK constraints into account when
    > synchronizing tables on two servers. The following is part of the proposed
    > script :
    >
    > Note that this script will carry out all DELETE commands for all tables
    > first, then all the UPDATES and then all the INSERTS
    > It will disable foreign key constraints at the beginning of the script,
    and
    > re-enable them at the end
    > */
    > SET XACT_ABORT ON
    > SET ARITHABORT ON
    > GO
    > -- Pointer used for text / image updates. This might not be needed, but is
    > declared here just in case
    > DECLARE @ptrval binary(16)
    >
    > BEGIN TRANSACTION
    > DELETE FROM .....
    >
    > It references the FK constraints, but they are not in there.
    > small bug?
    >
    > Best Regards
    >
    > Hans
This discussion has been closed.