Change Tracking Context

Posted on February 12, 2008

0


This is potentially very useful if you are intending to use Change Tracking. It is possible to set a context (“hey, all these changes were done as part of this process”). This can easily be done by

DECLARE @originator_id varbinary(128);
SET
@originator_id = CAST(‘SSIS’ AS varbinary(128));

WITH CHANGE_TRACKING_CONTEXT (@originator_id)
UPDATE MyTable
SET MyLocationId = 1100
WHERE MyId = 634

I say potentially because there is a drawback.. if there is another update before you bring back the changes , it’s change context is wiped.

Advertisements