-- If *this* query returns any rows SELECT 1from Interface aINNER JOIN AnotherDb.dbo.Trans b ON (convert(varchar, a.TICKET_NUM) = b.TICKET_NUM and a.TXN_DT = b.TXN_DT)where a.P_STATUS <> 'R' -- and b.TICKET_NUM is not null-- and b.TXN_DT is not nullOPTION (maxdop 0)-- Then *this* unrestricted update will run, affecting every rowUpdate dbo.INT_AS_VENTE_TITREset P_STATUS = 'R', P_ERROR_CODE = 'E000026'