An expression of non-boolean type specified in a context where a condition is expected - SQL Server REGEXP_LIKE

Viewed 43
CREATE TABLE Contesters 
(
        contester_id int primary key NOT NULL,
        full_name varchar(50) NOT NULL,
        email varchar(50) NOT NULL UNIQUE,
        phone_num varchar(12) NOT NULL UNIQUE,
        birthday date NOT NULL,
        age tinyint NOT NULL,
        datetime_created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
        passport_num bigint NOT NULL UNIQUE,
        median_res tinyint NOT NULL,
        bio varchar(200) NOT NULL,
        presentation_vid varchar(50) NOT NULL,
        CONSTRAINT full_name_cc CHECK (dbo.REGEXP_LIKE(full_name, '^[а-яА-ЯёЁa-zA-Z]+ [а-яА-ЯёЁa-zA-Z]+ ?[а-яА-ЯёЁa-zA-Z]+$')),
        CONSTRAINT email_cc CHECK (dbo.REGEXP_LIKE(email, '^[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}$')),
        CONSTRAINT phone_num_cc CHECK (dbo.REGEXP_LIKE(phone_num, '^((\+7|7|8)+([0-9]){10})$' ))
)

This code throws an error

Token error: 'An expression of non-boolean type specified in a context where a condition is expected, near ')'.' on server c349b3de3b7b executing on line 13 (code: 4145, state: 1, class: 15)

I'm trying to add a regex check when creating a table. This method worked a while ago, but now it seems to throw an exception.

0 Answers
Related