Hi!

Can you please ensure that if a check constraint exceed to number of character (word wrap) it will break before the Check word.

Current
ALTER TABLE mdm.Code_Mapping
ADD CONSTRAINT CHK_Code_Mapping CHECK (code_source IS NOT NULL
                                       OR code_target IS NOT NULL
                                      );
GO

Much better
ALTER TABLE mdm.Code_Mapping
ADD CONSTRAINT CHK_Code_Mapping
CHECK (code_source IS NOT NULL OR code_target IS NOT NULL)
GO

otherwise this will lead to really ugly code like you can see in the attached picture

Also I wonder why the CHECK constraint is not aligned with a Primary Key Constraint which is formatted as

ALTER TABLE mdm.Entities
ADD CONSTRAINT PKCL_Entities_entity_id
    PRIMARY KEY (entity_id)
    WITH (FILLFACTOR = 100) ON [DEFAULT];
GO

So I expected to see something like this:
ALTER TABLE mdm.Code_Mapping
ADD CONSTRAINT CHK_Code_Mapping
    CHECK (code_source IS NOT NULL OR code_target IS NOT NULL)
GO

or

ALTER TABLE mdm.Code_Mapping
ADD CONSTRAINT CHK_Code_Mapping
    CHECK (
                         code_source IS NOT NULL
                         OR code_target IS NOT NULL
                  )
GO

Thanks for the fix!

Torsten
MVP - FORG










torsten.strauss
0

Comments

2 comments

  • torsten.strauss

    torsten.strauss
    0
  • Jessica R
    Hi Torsten!

    Just updating this post: we've confirmed that this is a bug where the "Data types and constraints" formatting settings aren't applying to CHECK constraints. It's logged as SP-7480 and we'll post any updates to the bug here.

    Jessica R
    0

Add comment

Please sign in to leave a comment.