locked
WITH CHANGE_TRACKING_CONTEXT in after insert trigger when syncing with sqlserver 2008 RRS feed

  • Question

  • Hi,
      I have the following statement in an after insert trigger:

    DECLARE @originator_id varbinary(128);
    SET @originator_id = CAST('MyApplicationID' AS varbinary(128));
    WITH CHANGE_TRACKING_CONTEXT (@originator_id)
    UPDATE dbo.Opportunity SET number=@startOpportunityNbr, serie_letter= @letter_preferences WHERE id_opportunity=@LastID;


    unfortunatelly it is not working for me. I still see that the UPDATE is not taken as a separate change. As a result, when synchronizing the client that generated that new register does not see the effect of the update done by the after insert trigger.

    One thing that i see is that when i execute the query "SELECT * FROM CHANGETABLE(CHANGES Opportunity, 0) AS c;"  the SYS_CHANGE_CONTEXT is always NULL.

    I´m using DBs with Snapshot isolation.

    Thanks in advance,
    Paola
    Friday, August 21, 2009 12:46 PM

Answers

  • Paola,

    Could you include the DDL statement used to create the table.  This would be useful when attempting to repro.  Also, it seems that you have change tracking enabled.  Why do you also have a trigger on this table?

    Regards,


    Sean Kelley
    Senior Program Manager
    Microsoft
    Friday, September 4, 2009 4:39 PM
    Moderator