> What's the error you're receiving when trying to create the #temp table?
either
SELECT INTO command not allowed within a trigger.
or
CREATE TABLE command not allowed within a trigger.
> This in turn means you could rewrite your query as a join between the inserted table (contains a list of PKs
> of the rows you're interested in) and the base table. And if your base table has an index on the PK column(s)
> (ie, your join column(s)), then the optimizer should use the inserted table to drive the query (outer table) so
> that it can use the index on the base table (inner table).
It's something we've looked at but (since we're dealing with temporal data) the only way we know which are recently added and which were already there is to add some of batch id. However, since we're aiming to store a couple of billion rows, it seems a bit of a waste.