Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Posts
    2

    Unanswered: Trigger Creation in MYSQL

    Hi All,

    I need to create a Trigger in MYSQL. I have developed the following query for the same.

    Delimiter $$

    CREATE TRIGGER testref after INSERT ON audit
    FOR EACH ROW
    BEGIN
    if new.event_type_id=65540 then
    UPDATE Login SET status=0 where user_name= new.user_name;
    end if;
    END$$


    Problem Description: when a record is inserted in Table audit where EVENT_TYPE_ID=65540 then I need to update Column STATUS to 0 of the LOGIN table .

    Kindly Help.


    Thanks and Regards

  2. #2
    Join Date
    Apr 2009
    Posts
    2

    Error in the Above Syntax.

    The Above query was executed both in MYSQL Prompt and AQT Tool.
    But it is giving the following error:



    37000(1064)[MySQL][ODBC 5.1 Driver][mysqld-4.1.13a-pro]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Delimiter $$

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    your version of mysql does not support triggers

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •