What are the challenges you face when working across database platforms? Take the survey
Options

BUG: incorrect alias attempt

opc.threeopc.three Posts: 17 New member
edited April 15, 2016 4:43PM in SQL Prompt
IF EXISTS ( SELECT  c.name as column_name
                FROM    sys.schemas s
                        JOIN sys.tables t ON s.schema_id = t.schema_id
                        JOIN sys.columns c ON t.object_id = c.object_id
                WHERE   t.object_id = @parent_table_object_id
                EXCEPT
                SELECT  x.column_name
                FROM    ( VALUES 
                                  (N'column_name') ) AS x(column_name) )
    BEGIN
        -- Columns have been added to the base table since this trigger code was developed.
        -- A developer must regenerate this code using audit.setup_after_delete_audit_trigger
        -- and update this trigger.
        THROW 50000, 'Column-list mismatch occurred inside audit-trigger.', 1;
    END;

Code above causes SQL Prompt to fail formatting. It attempts to change this:

x(column_name)

to this:

x(x.column_name)

Comments

Sign In or Register to comment.