Reputation: 159
Here is a code and i am getting the following error
#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 '' at line 4
the trigger is as follows
CREATE TRIGGER updtrigger BEFORE UPDATE ON login
FOR EACH ROW
IF NEW.first >100 THEN
SET PASSWORD = furqan;
END IF;
END
Upvotes: 2
Views: 413
Reputation: 29051
Try this:
DELIMITER $$
DROP TRIGGER /*!50032 IF EXISTS */ `updtrigger`$$
CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `updtrigger` AFTER INSERT ON `login`
FOR EACH ROW BEGIN
IF new.first >100 THEN
SET new.password = 'furqan';
END IF;
END;
$$
DELIMITER ;
Upvotes: 0
Reputation: 50966
furqan is a string, and it should be in quotes
CREATE TRIGGER updtrigger BEFORE UPDATE ON login
FOR EACH ROW
IF NEW.first >100 THEN
SET PASSWORD = 'furqan';
END IF;
END
Upvotes: 3