Forum Discussion

mlauritsen's avatar
mlauritsen
Copper Contributor
Oct 10, 2024

Replacement for rules on alias types?

The documentation for CREATE RULE currently says that the feature will be removed in a future version of SQL Server.

Rules seem to be really useful to work around the fact that SQL Server doesn't have the enum types that other databases like PostgreSQL and MySQL have. Using CREATE TYPE, CREATE RULE (with a list of allowed values) and sp_bindrule you can define an enumerated type that can be used in multiple columns, making changes to the set of enum values much easier and less error prone compared to having to specify a CHECK constraint on each column.

Does anybody know when rules will be removed and if there are plans to provide another means of having centralized definitions of enumerated column types?

1 Reply

  • olafhelper's avatar
    olafhelper
    Bronze Contributor

     


    Does anybody know when rules will be removed and if there are plans to provide another means of having centralized definitions of enumerated column types?

    mlauritsen no one of us from the community can say.

Resources