Eradicating Dependencies of Tables

  • I want to eradicate all FK references at a time for all my tables.How?

  • This will generate a script to drop all FK's:

    SELECT 'ALTER TABLE ' +

    QUOTENAME( c.TABLE_NAME ) +

    ' NOCHECK CONSTRAINT ' +

    QUOTENAME( c.CONSTRAINT_NAME ) AS ALTER_SCRIPT

    FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS c

    WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'

    You don't need a parachute to skydive.

    You only need a parachute to skydive twice.


    You don't need a parachute to skydive.
    You only need a parachute to skydive twice.

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

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