Get the Column level difference for 2 database

  • Comments posted to this topic are about the item Get the Column level difference for 2 database

    Regards,
    Mitesh OSwal
    +918698619998

  • Copy and Paste into MS does not validate. Error at line 3 = sign.

  • Same here

    Msg 102, Level 15, State 1, Line 3

    Incorrect syntax near '='.

  • I got the same error, so I made them all Case statements.

    CASE WHEN COALESCE(CL.COLUMN_DEFAULT, '')= COALESCE(CL1.COLUMN_DEFAULT, '') THEN '' ELSE '|COLUMN_DEFAULT IS CHANGE' END +

    CASE WHEN COALESCE(CL.IS_NULLABLE,'')=COALESCE(CL1.IS_NULLABLE, '') THEN '' ELSE '|IS_NULLABLE IS CHANGE' END +

    CASE WHEN COALESCE(CL.DATA_TYPE,'')=COALESCE(CL1.DATA_TYPE, '') THEN '' ELSE '|DATA_TYPE IS CHANGE' END +

    CASE WHEN COALESCE(CL.CHARACTER_MAXIMUM_LENGTH,'')=COALESCE(CL1.CHARACTER_MAXIMUM_LENGTH, '') THEN '' ELSE '|CHARACTER_MAXIMUM_LENGTH IS CHANGE' END +

    CASE WHEN COALESCE(CL.CHARACTER_OCTET_LENGTH,'')=COALESCE(CL1.CHARACTER_OCTET_LENGTH,'') THEN '' ELSE '|CHARACTER_OCTET_LENGTH IS CHANGE' END +

    CASE WHEN COALESCE(CL.NUMERIC_PRECISION,'')=COALESCE(CL1.NUMERIC_PRECISION, '') THEN '' ELSE '|NUMERIC_PRECISION IS CHANGE' END +

    CASE WHEN COALESCE(CL.NUMERIC_PRECISION_RADIX,'')=COALESCE(CL1.NUMERIC_PRECISION_RADIX, '') THEN '' ELSE '|NUMERIC_PRECISION_RADIX IS CHANGE' END +

    CASE WHEN COALESCE(CL.NUMERIC_SCALE,'')=COALESCE(CL1.NUMERIC_SCALE, '') THEN '' ELSE '|NUMERIC_SCALE IS CHANGE' END +

    CASE WHEN COALESCE(CL.DATETIME_PRECISION,'')=COALESCE(CL1.DATETIME_PRECISION, '') THEN '' ELSE '|DATETIME_PRECISION IS CHANGE' END +

    CASE WHEN COALESCE(CL.CHARACTER_SET_CATALOG,'')=COALESCE(CL1.CHARACTER_SET_CATALOG, '') THEN '' ELSE '|CHARACTER_SET_CATALOG IS CHANGE' END +

    CASE WHEN COALESCE(CL.CHARACTER_SET_SCHEMA,'')=COALESCE(CL1.CHARACTER_SET_SCHEMA, '') THEN '' ELSE '|CHARACTER_SET_SCHEMA IS CHANGE' END +

    CASE WHEN COALESCE(CL.CHARACTER_SET_NAME,'')=COALESCE(CL1.CHARACTER_SET_NAME, '') THEN '' ELSE '|CHARACTER_SET_NAME IS CHANGE' END +

    CASE WHEN COALESCE(CL.COLLATION_CATALOG,'')=COALESCE(CL1.COLLATION_CATALOG, '') THEN '' ELSE '|COLLATION_CATALOG IS CHANGE' END +

    CASE WHEN COALESCE(CL.COLLATION_SCHEMA,'')=COALESCE(CL1.COLLATION_SCHEMA, '') THEN '' ELSE '|COLLATION_SCHEMA IS CHANGE' END +

    CASE WHEN COALESCE(CL.COLLATION_NAME,'')=COALESCE(CL1.COLLATION_NAME, '') THEN '' ELSE '|COLLATION_NAME IS CHANGE' END +

    CASE WHEN COALESCE(CL.DOMAIN_SCHEMA,'')=COALESCE(CL1.DOMAIN_SCHEMA, '') THEN '' ELSE '|DOMAIN_SCHEMA IS CHANGE' END +

    CASE WHEN COALESCE(CL.DOMAIN_NAME,'')=COALESCE(CL1.DOMAIN_NAME, '') THEN '' ELSE '|DOMAIN_NAME IS CHANGE' END ChangeDetail

    -------------------------------------------------------------
    we travel not to escape life but for life not to escape us
    Don't fear failure, fear regret.

Viewing 4 posts - 1 through 3 (of 3 total)

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