Une solution serait de faire une sous-sélection de l'intégralité de l'instruction, en appliquant la clause where à son résultat
select *
from (
select cast(de.ApprovalOrder AS VARCHAR(32))
+ cast(de.EntityCode AS VARCHAR(32))
+ isnull(cast(de.DelegationCode AS VARCHAR(32)), '') as 'RowID'
, *
from workflow.delegation_engine de
) de
where de.RowID IS NOT NULL
Une autre solution pourrait être de répéter toute la clause dans la clause WHERE
select cast(de.ApprovalOrder AS VARCHAR(32))
+ cast(de.EntityCode AS VARCHAR(32))
+ isnull(cast(de.DelegationCode AS VARCHAR(32)), '') as 'RowID' ,
*
from workflow.delegation_engine de
where cast(de.ApprovalOrder AS VARCHAR(32))
+ cast(de.EntityCode AS VARCHAR(32))
+ isnull(cast(de.DelegationCode AS VARCHAR(32)), '') IS NOT NULL
Ou vous pouvez tester chaque champ individuel pour NULL
select cast(de.ApprovalOrder AS VARCHAR(32))
+ cast(de.EntityCode AS VARCHAR(32))
+ isnull(cast(de.DelegationCode AS VARCHAR(32)), '') as 'RowID' ,
*
from workflow.delegation_engine de
where de.ApprovalOrder IS NOT NULL
AND de.EntityCode IS NOT NULL