I like to check in mu update trigger if order_status was set to 90 and it wasn’t before (deleted).
But the thing is: it need to check if order_status was set to 90 and if it never had the status 90 before (system versioned table)
I’m not sure if the system versioned table will already be updated after we are in the update trigger:
This is my current cursor
declare order_kop_cursor cursor for
select i.commission_nummer
,i.system
,i.order_nummer
,i.customer_name
,i.customer_email
,i.seller
,i.store
,i.installer
from inserted
where i.order_status = 90
and i.order_status not in
(
select okho.order_status
from order_kop_history_overview okho
where i.commission_nummer= okho.commission_nummer
and okho.order_status = 90
)
Can someone confirm if this will work how i want it to work or tell me how to fix it?
Sincerely,
Laurens Wolf