Home > Archive > MySQL ODBC Connector > October 2005 > DELETE Trigger









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DELETE Trigger
Scott Hamm

2005-10-27, 7:47 am

How do I create a trigger in MySQL similiar to the trigger created for mssq=
l:

CREATE TRIGGER DEL_DE ON KRONOS
AFTER DELETE
AS
=09DELETE FROM
=09=09DE_Metrics
=09WHERE
=09=09KID=3D(
=09=09=09SELECT
=09=09=09=09ID
=09=09=09FROM
=09=09=09=09DELETED
=09=09);

I already read online mysql TRIGGER, CREATE TRIGGER and USING TRIGGER
to no avail.
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Martijn Tonies

2005-10-27, 7:47 am

Hello Scott,

> How do I create a trigger in MySQL similiar to the trigger created for

mssql:
>
> CREATE TRIGGER DEL_DE ON KRONOS
> AFTER DELETE
> AS
> DELETE FROM
> DE_Metrics
> WHERE
> KID=(
> SELECT
> ID
> FROM
> DELETED
> );
>
> I already read online mysql TRIGGER, CREATE TRIGGER and USING TRIGGER
> to no avail.


I think - without trying -

AS
begin
delete from de_metrics where kid = old.id;
end

Check the syntax though :-)

Anyway, MySQL doesn't have the fake tables "deleted", but "per row"
triggers.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www. databasedevelopmentf
orum.com



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com