Een oplossing zou zijn om een subselectie te maken van het hele statement, en de waar-clausule op het resultaat toe te passen
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
Een andere oplossing zou kunnen zijn om de hele clausule in de WHERE-clausule te herhalen
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
Of u kunt elk afzonderlijk veld testen op 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