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"

  • Let me make sure I understand this line by line and have each right so far...

    First, isn't the line "WHERE Transaction_Type = 'From Bulk Assignment'"

    correctly referenceing the INSERTED with no additional qualifiers for this line needed?

    USE [TrackIT]

    GO

    CREATE TRIGGER [dbo].[trDecrementBulkPurchases]

    ON [dbo].[tblTransactions]

    AFTER INSERT

    AS

    BEGIN

    UPDATE [TrackIT].[dbo].[tblBulkPurchases]

    SET [Quantity_Remaining] = [Quantity_Remaining] - 1

    WHERE Transaction_Type = 'From Bulk Assignment'

    AND PO_Number IN (SELECT [PO_Number] FROM [tblBulkPurchases])

    END

    GO

    WHERE Transaction_Type = 'From Bulk Assignment'