I want to test a field value and alter a append a field to another table if the result of the test is true.
I dont want to create a procedure etc its a one off script I just want to pass it and its done with. But I get a 1064 error on the 'IF' int the statement bellow.
DELIMITER $$
IF 2 > (Select `Version` FROM `timecard`.`versionControl` WHERE `Table` = 'Employee') then
ALTER TABLE `timecard`.`Employee`
ADD COLUMN IPAddr VARCHAR(16) NULL AFTER PWord;
Update `timecard`.`VersionControl`
Set .`Version` = 2
where `Table` = 'Employee';
END IF $$
DELIMITER ;
Aucun commentaire:
Enregistrer un commentaire