Home Forums SQL Server 2008 T-SQL (SS2K8) Logic problem in "SET [Quantity_Remaining] = [Quantity_Remaining] - 1" RE: Logic problem in "SET [Quantity_Remaining] = [Quantity_Remaining] - 1"

  • Inside a trigger you have access to the inserted and deleted pseudo-tables which contain the rows that were affected by the operation that fired the trigger. You need to change the trigger so that the update joins or filters based on the inserted table so that it only updates rows that were affected by the insert.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass