List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:October 26 2005 3:06pm
Subject:Re: DELETE Trigger
View as plain text  
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.databasedevelopmentforum.com

Thread
DELETE TriggerScott Hamm26 Oct
  • Re: DELETE TriggerMartijn Tonies26 Oct