• hillerz19 (10/10/2012)


    Hi Sean Lange,

    This is my coding so far but allot of errors:

    ALTER TABLE ServiceTable

    ALTER COLUMN serviceCode char(4) NOT NULL,

    ALTER TABLE CaseTable

    DROP CONSTRAINT serviceCodeValues,

    ALTER TABLE CaseTable

    ALTER serviceCode DROP DEFAULT,

    Firstly on the CaseTable I dont see a column called servicecode, or a constraint called servicecodevalues so the code will fail.

    They are however there is a Constraint called ServiceCodeValues on the ServiceTable, but no Default value, You also have an FK reference on the serviceRenderedTable which uses the Servicecode on the Servicetable.

    1) Drop FK Constraint on ServiceRenderedTable

    2) Drop servicecovevalues Constraint on ServiceTable

    3) Alter Both Servicecode Column in Servicetable AND ServiceRenderedTable

    4) Update data in BOTH tables for new pattern, adding an X to the beginning of the servicecode column

    5) Reapply the Check Constraint on the Service table.

    6) Reapply FK Constraint on the ServiceRenderedTable

    One thing you an do is change the check to be : Check(serviceCode like '[X][C|E|O][0-9][0-9]') which is bit more readable.

    Make sure you test this in a dev environment.

    I dont think I've missed any steps.

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices