If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Trigger Creation in MYSQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-16-09, 05:11
anil.enigma anil.enigma is offline
Registered User
 
Join Date: Apr 2009
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 04-16-09, 05:42
anil.enigma anil.enigma is offline
Registered User
 
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 $$
Reply With Quote
  #3 (permalink)  
Old 04-16-09, 08:22
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
your version of mysql does not support triggers

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On