trigger order

mulmadmulmad Posts: 94
edited January 8, 2007 6:59AM in SQL Compare Previous Versions
I unsure if after trigger execution order (set by using sp_settriggerorder) is syncronised between instances? (I'm not even sure where this info is stored).

Comments

  • Hi there,

    The objectproperty system function allows you to query the trigger order of any trigger. So if you want to independently verify that the trigger order has been updated the following code can be used, just change the object name from dbo.triggerA to your trigger's name.
    DECLARE @id AS INT,@objectName AS NVARCHAR(128)
    SET @objectName = N'dbo.triggerA'
    SELECT  @id = OBJECT_ID(@objectName)
    SELECT  OBJECTPROPERTY(@id, 'ExecIsFirstDeleteTrigger') AS ExecIsFirstDeleteTrigger,
            OBJECTPROPERTY(@id, 'ExecIsFirstUpdateTrigger') AS ExecIsFirstUpdateTrigger,
            OBJECTPROPERTY(@id, 'ExecIsFirstInsertTrigger') AS ExecIsFirstInsertTrigger,
            OBJECTPROPERTY(@id, 'ExecIsLastDeleteTrigger') AS ExecIsLastDeleteTrigger,
            OBJECTPROPERTY(@id, 'ExecIsLastUpdateTrigger') AS ExecIsLastUpdateTrigger,
            OBJECTPROPERTY(@id, 'ExecIsLastInsertTrigger') AS ExecIsLastInsertTrigger
    

    Hope this helps,

    Regards,

    Jonathan
    Jonathan Watts

    -Project Manager
    -Red Gate Software Ltd
Sign In or Register to comment.