I was trying to execute this query below but, the SQL Server returns this error:
Incorrect syntax definition of constraint ' TABLE'
Here the part of the query which have the error
create table Vendedor
(
Vend_idVendedor int identity,
Vend_Nome VARCHAR(45) not null,
Vend_CPF int not null,
Vend_Cargo VARCHAR(15) not null,
Vend_Salario FLOAT not null,
Vend_Telefone INT not null,
Vend_Celular INT not null,
Vend_Admissao DATE not null,
constraint PK_Vend_idVend primary key (Vend_idVendedor),
constraint CK_Vend_CPF check(len(Vend_CPF) = 11),
constraint CK_Vend_Tel check(len(Vend_Telefone) = 10),
constraint CK_Vend_Cel check(len(Vend_Celular) = 11),
constraint UQ_Vend_CPF unique(Vend_CPF),
constraint UQ_Vend_Cel unique(Vend_Celular),
constraint CK_Vend_Adm check(Vend_Admissao >= '2016-01-02' and Vend_Admissao <= getdate())
)
There is nothing wrong with the above statement. It created a table on my SQL 2008 R2 Dev.
Check for errors in the preceding statements.
If you working in SSMS you can try adding right before and after your statement a batch separator (GO
) to isolate it. Semi-colon (;) may help as well.