I'm trying to create a function in my mySQL database using entity framework migrations. The SQL works great when I run it directly in MySQL Workbench but it fails when it runs in the EF migration.
How can I create a function using EF migration?
Sql(@"
DROP function IF EXISTS `f_JumperName`;
DELIMITER $$
CREATE FUNCTION `f_JumperName`
(
JumperID int
)
RETURNS varchar(500)
BEGIN
DECLARE result VARCHAR(500);
SELECT j.LastName + ', ' + j.FirstName
INTO result
FROM Jumper j
WHERE j.JumperID = JumperID;
RETURN x;
END$$
DELIMITER ;
");
Error message: 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 'DELIMITER $$
CREATE FUNCTION f_JumperName
(...