Im using microsoft sql server and Im learning basics of sql... I have a table that contains name of patients and their primary doctors. I want to check that a doctor can not be a primary doctor for more than 4 patients here is what I have tried:
CREATE ASSERTION assertion12
(not exist(
select DOCTOR.SSN
from Patient, DOCTOR
where Patient.primaryDoctor_SSN = DOCTOR.SSN
group by DOCTOR.SSN
having count(primaryDoctor_SSN) >= 5
);
but I get the error in the first line: "could not find stored procedure" . (actually a red line comes under "CREATE" and shows this message )
What should I do?! I have check some sites and I saw writing assertions is like what I have done and I don't know why do I get this error.