question

ecomma avatar image
ecomma asked

Trigger error on mysql

Am trying to configure mysql as the backend storage for gammu with kalkun. Icreate the phone database as descripbed here:[Here][1] [1]: http://wammu.eu/docs/manual/smsd/mysql.html I used the same script used to create trigger but when i running i get this error: MySQL said: > Documentation > \#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 5 Trigger: CREATE TRIGGER phones_timestamp BEFORE INSERT ON phones FOR EACH ROW BEGIN IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN SET NEW.InsertIntoDB = CURRENT_TIMESTAMP(); END IF; IF NEW.TimeOut = '0000-00-00 00:00:00' THEN SET NEW.TimeOut = CURRENT_TIMESTAMP(); END IF; END;//
mysqltriggers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sqlaj 1 avatar image
sqlaj 1 answered
Did you "check the manual that corresponds to your MySQL server version..."? I found this page: http://dev.mysql.com/doc/refman/5.5/en/datetime.html and don't see CURRENT_TIMESTAMP". It looks like it should be "TIMESTAMP" This is one for Creating Triggers: http://dev.mysql.com/doc/refman/5.1/en/trigger-syntax.html
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.