我需要將MS SQL
觸發器創建命令轉換爲MySQL
中類似命令的幫助。它在MS SQL中工作正常,但我對MySQL一無所知。Microsoft SQL到MySQL觸發器
的命令是因爲它遵循:
USE [Project]
GO
/****** Object: Trigger [General].[TR_tblFirmaZaposleni_U] Script Date: 7.1.2014 17:47:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [General].[TR_tblFirmaZaposleni_U]
ON [General].[tblFirmaZaposleni]
FOR UPDATE
AS UPDATE [General].[tblFirmaZaposleni]
SET [A_tblFirmaZaposleniUpdatedBy] = SUBSTRING(SUSER_SNAME(),(CHARINDEX('\',SUSER_SNAME()) + 1),LEN(SUSER_SNAME())), [A_tblFirmaZaposleniUpdatedOn] = GetDate()
FROM [General].[tblFirmaZaposleni] s
INNER JOIN [INSERTED] i ON s.[ZaposleniID] = i.[ZaposleniID]
INSERT INTO ProjectAudit.[General].[tblFirmaZaposleni] SELECT 'B','U',* FROM DELETED
INSERT INTO ProjectAudit.[General].[tblFirmaZaposleni] SELECT 'A','U',* FROM INSERTED
GO
非常感謝你,eggyal!你一直很有幫助。 –
我想最有用的鏈接,我忽略了包括在我的回答中,是MySQL的['CREATE TRIGGER'語法](http://dev.mysql.com/doc/en/create-trigger.html)的文檔。 – eggyal
再次感謝您。 –