Trigger not working properly

  • Hi.

    I have a table A in which datq gets inserred through stored procedure. I also have insert trigger on that table. In the trigger i make the record inset into another table B feom INSERTED. Simple insert statement.
    Problem is some records get insertted some dont..kindly help how to trace this issue and solve it

  • saum70 - Saturday, January 5, 2019 9:36 PM

    Hi.

    I have a table A in which datq gets inserred through stored procedure. I also have insert trigger on that table. In the trigger i make the record inset into another table B feom INSERTED. Simple insert statement.
    Problem is some records get insertted some dont..kindly help how to trace this issue and solve it

    Please post the DDL (create table) scripts, the code for the stored procedure and the code for the trigger.
    😎

  • I suspect that you have a trigger that assumes that only one row will ever be inserted at a time. Post the DDL, like Eirikur asked for, and we'll very quickly know.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • saum70 - Saturday, January 5, 2019 9:36 PM

    Hi.

    I have a table A in which datq gets inserred through stored procedure. I also have insert trigger on that table. In the trigger i make the record inset into another table B feom INSERTED. Simple insert statement.
    Problem is some records get insertted some dont..kindly help how to trace this issue and solve it

    Patently, the trigger has been written incorrect.  Post the code for the trigger.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 4 posts - 1 through 3 (of 3 total)

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