Another Trigger Question!

Another Trigger Question!

am 09.07.2009 02:14:39 von Marcel Grandemange

------=_NextPart_000_02B0_01CA003B.03D631C0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Good Day once again.



Im needing assistance again with triggers!





Create Trigger hostchange

BEFORE UPDATE ON host

FOR EACH ROW

BEGIN

IF NEW.status != OLD.status THEN

use smsgw;

insert into outbox (number, insertdate, text, phone, dreport) VALUES
('0836075144', '', 'HostDown', '1', '1')");

END IF;

END;





I have my idea of a trigger above that for obvious reasons wont work ,
however describes what im trying to do best!

Im monitoring a value status and if it changes id like to insert a record
into a entirely separate table in a separate DB.



Any ideas on how syntax should be?

Also anyone know of any good ebooks that describe triggers in depth? I find
most info I find on web is simplistic at best or simply don't explain well
anough for my level!





Regards


------=_NextPart_000_02B0_01CA003B.03D631C0--

Re: Another Trigger Question!

am 09.07.2009 04:11:55 von Dan Nelson

In the last episode (Jul 09), Marcel Grandemange said:
> Create Trigger hostchange
> BEFORE UPDATE ON host
> FOR EACH ROW
> BEGIN
> IF NEW.status != OLD.status THEN
> use smsgw;
> insert into outbox (number, insertdate, text, phone, dreport) VALUES
> ('0836075144', '', 'HostDown', '1', '1')");
> END IF;
> END;
>
> I have my idea of a trigger above that for obvious reasons wont work ,
> however describes what im trying to do best!
>
> Im monitoring a value status and if it changes id like to insert a record
> into a entirely separate table in a separate DB.

insert into smsgw.outbox [...]

--
Dan Nelson
dnelson@allantgroup.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org