• svanduffelen 83303 (4/27/2015)


    This is a single table problem with two columns and 5 data integrity rules.

    1.) The First Column is the primary key, Ticket, of type Integer

    2.) The Second is Void of type integer also uniquely indexed excluding nulls.

    3.) A void ticket must exist in the primary key and is enforced by a FK constraint.

    4.) A void ticket must not be replaced by itself, enforced by table constraint

    5.) A Replacement Ticket must not be void at the time of insert/update

    I can handle the first four constraints, but not the fifth. and I have just developed a recursive query using CTE to move through the linked columns, but without the 5th constraint it is possible to create an endless loop, which would not be good. Anybody know a trick the will help in SQL 2005

    Can you explain what this means, in terms of column values in the database, please:

    A Replacement Ticket must not be void at the time of insert/update

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.