Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Update Trigger in SQL 2000

  • 09-03-2009 12:16pm
    #1
    Registered Users, Registered Users 2 Posts: 224 ✭✭


    Hi, im having problems compiling a trigger. bacically i need the trigger to pull back a number that increments with each update. This is my poor attempt. Any suggestions are more than welcome.


    CREATE TRIGGER [UpdCloneItemCode] ON [dbo].[tblUnitMatrix]
    FOR UPDATE
    AS
    Declare @itemcode VARCHAR(50)
    If NOT UPDATE(ItemCode)
    Begin
    Return
    END
    Select CounterValue From tblCounter
    UPDATE tblCounter SET CounterValue=CounterValue+1


Comments

  • Moderators Posts: 51,922 ✭✭✭✭Delirium


    Hi, im having problems compiling a trigger. bacically i need the trigger to pull back a number that increments with each update. This is my poor attempt. Any suggestions are more than welcome.


    CREATE TRIGGER [UpdCloneItemCode] ON [dbo].[tblUnitMatrix]
    FOR UPDATE
    AS
    Declare @itemcode VARCHAR(50)
    If NOT UPDATE(ItemCode)
    Begin
    Return
    END
    Select CounterValue From tblCounter
    UPDATE tblCounter SET CounterValue=CounterValue+1

    Do you mean you want to use the variable outside the trigger?

    If you can read this, you're too close!



  • Registered Users, Registered Users 2 Posts: 224 ✭✭The Mighty Dubs


    Correct.Thats the variable i want to insert.


  • Moderators Posts: 51,922 ✭✭✭✭Delirium


    Correct.Thats the variable i want to insert.
    Ok. You could just query the table that has the value after the insert.

    I'm not aware of a way to pass a variable out of a trigger. I've only a limited experience of SQL.

    If you can read this, you're too close!



Advertisement