“1292 Incorrect datetime value” when updating a different field
There are a lot of great Stackoverflow questions/answers with regard to this error. However, most (all) are focused on updating the problem field itself. For example, a common solution is to set sql_mode to NO_ENGINE_SUBSTITUTION (thus disabling strict mode) and then updating the field that currently has a 0000-00-00 value.
Truncated date value throws error when called in stored procedure
FUNCTION `ufn_Get_DocNo_New`(in_TableID TINYINT, in_BookType TINYINT, in_DocDate DATE, in_VendorID SMALLINT) RETURNS VARCHAR(12) CHARSET utf8 BEGIN DECLARE v_MonthLike VARCHAR(8); DECLARE v_PreText VARCHAR(2); DECLARE v_YYMM VARCHAR(6); DECLARE v_DocNo VARCHAR(10); SET v_MonthLike = CONCAT(SUBSTR(in_DocDate,1,7),’%’); SET v_YYMM = CONCAT(‘/’,DATE_FORMAT(in_DocDate, ‘%y%m’),’/’); IF in_TableID = 22 THEN IF in_BookType = 1 THEN SET v_PreText = ‘CS’; ELSEIF in_BookType = 2 THEN SET […]