Korzystam z MSSQL Server 2005 i moje Query to:
CREATE TABLE Zarobki ( Id_do INT, Id_z INT, Pensja_zasadnicza DECIMAL(10,2), Premia DECIMAL(6,2), Dodatek DECIMAL(6,2), CONSTRAINT id_do_id_z_kp PRIMARY KEY (Id_do, Id_z))
Wykonuje się bezproblemowo, ale problem pojawia się jak chcę dorzucić drugie ograniczenie na wprowadzane wartośći:
CREATE TABLE Zarobki ( Id_do INT, Id_z INT, Pensja_zasadnicza DECIMAL(10,2), Premia DECIMAL(6,2), Dodatek DECIMAL(6,2) CONSTRAINT id_do_id_z_kp PRIMARY KEY (Id_do, Id_z) CONSTRAINT pensja_z_ck CHECK (Pensja_zasadnicza BETWEEN 840 AND 3000) NOT NULL)
Błąd wygląda tak:
Cytat
Msg 8141, Level 16, State 0, Line 1
Column CHECK constraint for column 'Dodatek' references another column, table 'Zarobki'.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
Column CHECK constraint for column 'Dodatek' references another column, table 'Zarobki'.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
O co chodzi ?