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 is not working, like this:
INSERT INTO Versao (codigo) VALUES ('0.123.0198651687.1');
Theoretically, based on this test I did on the site RegExr the regex would validate if the used code contains only numbers and has 4 blocks with 3 points between them, So why does not my SQL Server want to accept the insert?