Minimum and maximum values in a field in SQL server

1

As I indicated the maximum and minimum value of an int type field in the database.

I tried this code, but it does not work for me.

Sexo char(1) CHECK (Sexo IN ('F','M')) //Funciona
Nota_Practica int NOT NULL CHECK (Nota_Practica > 0 && Nota_Practica < 60), //no funciona
Nota_Parcial int NOT NULL CHECK (Nota_Parcial > 0 && Nota_Parcial < 40), //no funciona
Nota_Final int DEFAULT (Nota_Practica + Nota_Parcial)
    
asked by Jesse R. Jose 06.07.2017 в 20:22
source

1 answer

4

I guess you're creating the table.

Nota_Practica int NOT NULL CHECK (Nota_Practica > 0 AND Nota_Practica < 60),
Nota_Parcial int NOT NULL CHECK (Nota_Parcial > 0 AND Nota_Parcial < 40),

Notice that you use And instead of &&

    
answered by 06.07.2017 / 20:28
source