marshall marshall - 7 months ago 43
SQL Question

check sql query like enum in mysql

in mysql i'm using enum and display variable with enum_range.
how to display check variable range in sql server if

roles VARCHAR(10) NOT NULL CHECK (roles IN('Admin', 'Staff', 'User'))


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.