MSCEWI2032

Columns were reordered.

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Severity

Low

Description

One or more of the referenced columns inside the REFERENCES portion of the FOREIGN KEY were reordered to match the indexes (or positions) of the specified table.

Example Code

Input Code:

      CREATE TABLE FK1(
            COL1 INTEGER,
            COL2 INTEGER,
            COL3 INTEGER,
            PRIMARY KEY (COL1, COL2))
            PRIMARY INDEX (COL1, COL2, COL3);
      
      CREATE TABLE FK2(
            COL1 INTEGER,
            COL2 INTEGER,
            COL3 INTEGER,
            -- The column references here require reordering.
            FOREIGN KEY (COL1, COL2, COL3) REFERENCES FK1 (COL2, COL1, COL3)
      );

Output Code:

      CREATE TABLE DATAWAREHOUSE.PUBLIC.FK1 (
      COL1 INTEGER,
      COL2 INTEGER,
      COL3 INTEGER,
      PRIMARY KEY (COL1, COL2));
      
      CREATE TABLE DATAWAREHOUSE.PUBLIC.FK2 (
      COL1 INTEGER,
      COL2 INTEGER,
      COL3 INTEGER
      );
      
      /*** MSC-WARNING - MSCEWI2032 - REFERENCED COLUMNS WERE REORDERED TO MATCH FK1 INDEXES ***/
      ALTER TABLE DATAWAREHOUSE.PUBLIC.FK2 ADD CONSTRAINT COL1
      FOREIGN KEY (COL1, COL2, COL3) REFERENCES DATAWAREHOUSE.PUBLIC.FK1 (COL1, COL2, COL3) ;

Recommendations

Last updated