0
Hello I am creating a table in Sqlserver where I want to validate a field to only accept the correct version mask, like this:
CREATE TABLE Versao (
id INT NOT NULL IDENTITY(1,1),
codigo NVARCHAR(100) NOT NULL,
CONSTRAINT [PK_Versao] PRIMARY KEY (id),
CONSTRAINT [CK_Versao_codigo] CHECK (codigo LIKE '%[0-9]+.[0-9]+.[0-9]+.[0-9]+%')
);
My problem is when I try to insert a record but it’s not working like this:
INSERT INTO Versao (codigo) VALUES ('0.123.0198651687.1');
Theoretically, based on this test I did on the website Regexr regex would validate if the code used contains only numbers and has 4 blocks with 3 points between them, so why my SQL Server does not want to accept the Insert?