0

In MySQL I'm using enum and display variable with enum_range. How can I display check variable range in SQL Server if

roles VARCHAR(10) NOT NULL CHECK (roles IN('Admin', 'Staff', 'User'))
TT.
  • 15,774
  • 6
  • 47
  • 88
marshall
  • 74
  • 1
  • 7

1 Answers1

2

If you want to see the values, don't use either enum or check. Use foreign key constraints:

create table Roles (
    RoleId int identity primary key,
    RoleName varchar(255)
);

insert into Roles(RoleName)
    values ('Admin'), ('Staff'), ('User');

create table . . . (
    . . .
    RoleId int references Roles(RoleId),
    . . .
);

The shortcuts you want to use just get in the way of using the capabilities of the database.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786