Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Trigger NOT Fireing...

Trigger NOT Fireing...

Scheduled Pinned Locked Moved Database
helpdatabasetoolsquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Elizma
    wrote on last edited by
    #1

    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

    B J 2 Replies Last reply
    0
    • E 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

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Instead using triggers I suggest you doing insert in your Log Table.


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

      1 Reply Last reply
      0
      • E 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

        J Offline
        J Offline
        Jerry Hammond
        wrote on last edited by
        #3

        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

        E 1 Reply Last reply
        0
        • J Jerry Hammond

          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

          E Offline
          E Offline
          Elizma
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups