DELIMITER $$
CREATE TRIGGER `krishna`.`tbl_venue_BEFORE_INSERT1` BEFORE INSERT ON `tbl_venue` FOR EACH ROW
Begin
if new.ground_name =.ground_name
then
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Cannot add or update row: only one active row allowed per type';
END IF ;
END $$
DELIMITER ;
我想在同一個表中已經存在的地面名比較new.ground_name ...但我得到了一個語法錯誤:是觸發程序
Error Code: 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 'then SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Cannot add or update row: only ' at line 4
Mysql和ms sql server是兩種不同的產品。請僅使用相關的產品標籤。此外,請分享整個錯誤消息,因爲它會告訴我們在哪裏語法錯誤(雖然我有預感) – Shadow
這個問題需要一些嚴重的編輯... –