MySQL Forums
Forum List  »  Other Migration

how to convert sql trigger to mysql
Posted by: Omer Ahmed
Date: July 15, 2022 03:25AM

Dear all
i shifted from sql server to mysql . i wrote one trigger in sql server but now i m facing issues while converting it to mysql.
can anyone please help me

below is the trigger

USE [medicav1]
GO
/****** Object: Trigger [dbo].[COI_tri] Script Date: 7/15/2022 1:27:20 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[COI_tri] ON [dbo].[COA]
FOR INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS ( SELECT * FROM inserted)
RETURN
UPDATE dbo.COA
SET accounttype = CASE WHEN COA.openingbalance > 0 THEN 'DR'
ELSE 'CR' END
FROM dbo.COA COA
WHERE EXISTS ( SELECT *
FROM inserted i
WHERE i.coaid = COA.coaid
)
END

Options: ReplyQuote


Subject
Views
Written By
Posted
how to convert sql trigger to mysql
622
July 15, 2022 03:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.