Simple mySQL Problem

Soldato
Joined
8 Oct 2003
Posts
2,876
Location
Glasgow
Hey guys,

I normally work with oracle stuff, but today I'm messing around with mysql. Anyway I am trying to compile a trigger

DROP trigger PAGES2_TRG_2
delimiter $$
CREATE TRIGGER PAGES2_TRG_2
BEFORE insert ON PAGES2
FOR EACH ROW
BEGIN
IF NEW.DATE is null THEN
SET NEW.DATE = CURDATE();

END IF;
END$$

The lines in bold keep giving me a syntax error #1064 ??

edit**

DATE is 'datetime'

Thanks Kevin.
 
fixed it :D

delimiter $$
CREATE TRIGGER `PAGES2_TRG_2`
BEFORE insert ON `PAGES2`
FOR EACH ROW
BEGIN
IF NEW.DATE = '1000-01-01 00:00:00' THEN
SET NEW.DATE = CURDATE();
END IF;
END;
 
Back
Top Bottom