'Adding a stored procedure to Using DATEDIFF
I am getting the error "Incorrect parameter count in the call to native function 'DATEDIFF'". I am trying:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `employeeAgeCheck`(IN `birthday` DATE)
NO SQL
SELECT DATEDIFF(year,`birthdate`,GETDATE()) AS bday
$$
DELIMITER ;
What am I doing wrong?
Solution 1:[1]
The MySQL DATEDIFF function takes only 2 parameters - two dates. You are passing three as if you were using the SQL Server DATEDIFF function. You need to ensure you are passing the correct parameters within your stored procedure.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | strickt01 |
