Trigger Problems...

  • Hi There,

    I am having problems creating a trigger that will update another table with values out of the source table insert.

    My scripting is below

    --------------------------------------------------------------------------------

    CREATE TRIGGER [test] ON [acmem]

    FOR UPDATE

    AS

    SET NOCOUNT ON

    INSERT INTO genesysLOGIN.dbo.agentINFODNA ( agentODN, agentADN,QueueID)

    SELECT '0' as agentODN, extno as agentADN, '1' as QueueID FROM INSERTED

    WHERE ltrim(groupno) = "4629"

    GO

    --------------------------------------------------------------------------------

    Symptoms...

    FOR INSERT...

    Both the source and target tables do not insert the data.

    FOR UPDATE...

    Only the target table doesnt update...

    Is there something wrong with my syntax? Could there be something else I have missed....

    I would appreciate some help on this one! Im going to need some "Regain" at this rate...


    Scott Blakeman

    "When you do something incredible, try not to look amazed" --someone

  • Change = "4629" to = '4629'

    I believe the quotes may be causing an error.

  • No Joy... Is there anyway to see debug msg's?

    Scott Blakeman

    "When you do something incredible, try not to look amazed" --someone


    Scott Blakeman

    "When you do something incredible, try not to look amazed" --someone

  • What happens if you run the query against the table itself outside of the trigger.

    Doing instead from the table.

    Also don't think they are but for the chance it might make the two follwoing changes.

    CREATE TRIGGER [test] ON [acmem]

    to

    CREATE TRIGGER [test] ON [dbo].[acmem]

    and

    FROM INSERTED

    to

    FROM inserted

    (I can't remember for sure if inserted is case sensitive)

    If your query otherwise works fine and the trigger doesn't work after the changes the open Profiler and do a trace of all TSQL completed items, SP completed items and sorry I don't have it in front of me but Trigger items if that options is there. The filter only for this DB and test your inserts, this should give you an idea of what is happening.

  • Thanks...

    I finally got it to work. The problem turned out to be permissions...

    Bah humbug!!!

    Thanks for taking the time out help

    Regards

    Scott Blakeman

    "When you do something incredible, try not to look amazed" --someone


    Scott Blakeman

    "When you do something incredible, try not to look amazed" --someone

  • Glad to hear.

    Don't roll your eyes at me. I will tape them in place.

Viewing 6 posts - 1 through 5 (of 5 total)

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