6

I am getting this error :
"Error 102 : non-boolean type specified in a context where a condition is expected"
for this request :

DECLARE @num_dossiers TABLE (num_dossier INT,indice NVARCHAR(3))
insert into @num_dossiers
select num_dossier,indice from dossier where num_sec=57

delete from constitue where (num_dossier,indice) in select (num_dossier,indice) from @num_dossiers  

The request triggering the error is the last one :

delete from constitue where (num_dossier,indice) in select (num_dossier,indice) from @num_dossiers   

What could be the cause of this error ?

15

SQL Server doesn't support a multi-column IN clause (unlike Oracle).

delete 
from constitue 
where (num_dossier,indice) in select (num_dossier,indice) from @num_dossiers 

This can be rewritten as a EXISTS:

DELETE c
FROM constitue c
WHERE EXISTS 
    (SELECT 1 FROM @num_dossiers nd WHERE n.num_dossier = c.num_dossier AND n.indice = c.indice);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.