Recursive Trigger Problem

  •  Hi,

      I'm using windows Sharepoint Services for my application. This

    sharepoint site contains One Database. In this database one table

    called Docs Table is there. In this Docs Table i have written

    Insert,Update and Delete Triggers.

    Problem i'm facing:

    When i insert any row in this table(the insertion will be performed

    when i create a New Document in Sharepoint site or when i Create New

    Folder in Sharepoint site) my Insert Trigger is called correctly in

    addition Update trigger is also Called for the same row.

    When i update any row(the Updation will be performed when i edit a

    Document in Sharepoint site or when i edit a Folder Name in Sharepoint

    site) the Update event for the row is called more than once(upto min 5

    times including Origianl Update event)

    I already set

    sp_configure,'nested triggers',0

    sp_configure,'server trigger recursion',0

    exec sp_dboption 'STS_gsdindia-11_1782140429','recursive

    Triggers','false'

    But still my trigger is calling recursively itself in Update and in

    Insert Update Event is raised for the same row.

    I'm using SQL Server 2005 and I have created CLR Project(SQL Server Project).  In that project i'm justing getting the Two Column Values from Inserted and Deleted.  Nothing Complex in my Code.

    Why Even if i set  the following , there is no result.

    sp_configure,'nested triggers',0

    exec sp_dboption 'STS_gsdindia-11_1782140429','recursive Triggers','false'

    why it is recursively firing more than one time in Update and in Insert Why its firing Update Trigger

    Here my CLR Code :

    SqlTriggerContext sqlTrigger = SqlContext.TriggerContext;

    SqlPipe sqlPipe = SqlContext.Pipe;

    SqlCommand cmd = objTriggers.con.CreateCommand();

    if (sqlTrigger.TriggerAction == TriggerAction.Insert || sqlTrigger.TriggerAction == TriggerAction.Update)

    cmd.CommandText = "select DirName,LeafName from inserted";

    if (sqlTrigger.TriggerAction == TriggerAction.Delete)

    cmd.CommandText = "select DirName,LeafName from Deleted";

    When i execute the cmd I can able to get Both DirName,LeafName.

    Is this information is sufficient to help me.or you need anything else.

    me to solve this issue.

    Thanks,

    Vinoth

    How can i solve this issue. Is anybody knows solution please let me

    know to solve it.

    Thanks,

    Vinoth

  • Can we see the code of the update trigger?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply