Trigger NOT Fireing...
-
Hi I am using SQL 2005. I have a trigger for insert on a table. In the script I read everything from the inserted table and write it into a User Log table. It seems as if the trigger is not fireing when the insert happens, but if I copy the records, delete it from the table and paste them back in, it fires the trigger. Have anyone experience this problem before, and if you have, what can I do to fix this? Your help on this will be greatly appreciated. Kind Regards, Elizma
-
Hi I am using SQL 2005. I have a trigger for insert on a table. In the script I read everything from the inserted table and write it into a User Log table. It seems as if the trigger is not fireing when the insert happens, but if I copy the records, delete it from the table and paste them back in, it fires the trigger. Have anyone experience this problem before, and if you have, what can I do to fix this? Your help on this will be greatly appreciated. Kind Regards, Elizma
-
Hi I am using SQL 2005. I have a trigger for insert on a table. In the script I read everything from the inserted table and write it into a User Log table. It seems as if the trigger is not fireing when the insert happens, but if I copy the records, delete it from the table and paste them back in, it fires the trigger. Have anyone experience this problem before, and if you have, what can I do to fix this? Your help on this will be greatly appreciated. Kind Regards, Elizma
show us your code please.
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
-
show us your code please.
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
Hi Here is my code. CREATE Trigger [trg_MovementsLog] ON [dbo].[GtrDetail] FOR INSERT AS INSERT INTO tblMovementsLog(GtrReference,Line,StockCode, QtyMoved, MovedBy,TransactionDate) SELECT inserted.GtrReference,inserted.Line, inserted.StockCode, inserted.GtrQuantity AS QtyMoved, SUBSTRING(LotTransactions.Narration,9,Len(LotTransactions.Narration)-8) AS MovedBy, inserted.TransactionDate FROM inserted INNER JOIN GtrLot ON inserted.GtrReference = GtrLot.GtrReference AND inserted.Line = GtrLot.Line INNER JOIN LotTransactions ON GtrLot.Lot = LotTransactions.LotJob AND inserted.GtrReference = LotTransactions.Reference AND inserted.StockCode = LotTransactions.StockCode WHERE (inserted.TargetWarehouse = 'HS') AND (NOT (inserted.TransferComplete = 'Y')) AND (LotTransactions.Narration LIKE 'JOB_TRF_%') I know however that my code does work. The trigger use to work fine until they re-installed the server. Also it runs if I manually insert a record into the GtrDetail table. It just does not run when it's basically inserted via a script (Well, so it seems). Thanx for your assistance. Elizma
modified on Thursday, July 2, 2009 2:55 AM