Reputation: 187
I'm using phpmyadmin and I can't figure to how to get it to automatically set empty strings to null while importing data, so I'm trying to write a trigger to do it.
My trigger will eventually have to include many more fields than this, but this is my test run trigger, which is not working:
create trigger test1
before insert
on hvi
for each row
begin
if new.`Amt` = ' ' then
set new.`Amt` = null
end if;
end;
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 'end if' at line 8
What am I doing wrong?
Upvotes: 0
Views: 3774