We implementing temporal data and looking to use triggers to do the hard work.
We'd like to add a check to the trigger which involves a self-join of the pseudo-table "inserted".
ie
if exists ( select 1
from inserted before,
inserted after
where .....
however this is obviously very slow for large data (more than 5,000 rows) as there are no indexes on the inserted pseudo table.
We tried selecting the data into a temp table (but this isn't allowed in ASE - but is allowed in MS-SQL).
Is there some way of improving the performance of the inserted tables ?
Is there some way of relaxing the prevention of creation of temp tables from triggers
Any one done anything similar ?