邮件触发错误

时间:2017-06-26 07:40:27

标签: php sql triggers phpmyadmin

我收到以下错误。你能帮我解决一下吗

触发

CREATE TRIGGER notifyMe
ON sb_clients
AFTER UPDATE
AS
exec msdb.dbo.sp_send_dbmail
@profile_name = 'DB AutoMailer',
@recipients = 'mail@mail.com',
@body = 'The DB has changed',
@subject = 'DB Change'

错误

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON sb_clients
AFTER UPDATE
AS
exec msdb.dbo.sp_send_dbmail
@profile_name = '' at line 2

1 个答案:

答案 0 :(得分:0)

在您的错误中,它表示" 对应于您的MySQL服务器版本"所以我猜你使用MySQL作为你的数据库。你有几个错误:

  1. sp_send_dbmail是SQL Server函数
  2. 根据MySQL参考,CREATE TRIGGER句子中的顺序是错误的。
  3. 它应该类似于:

    CREATE TRIGGER notifyMe
    AFTER UPDATE
    ON sb_clients
    [Your trigger code]