使用sql语句时date类型如何插入数据
Error Code: 1292. Incorrect date value: ‘1987’ for column ‘checkindate’ at row 1
我个人觉得有用简单的方法:
日期用单引号括起来,
eg:update bedmanage,patient set bedmanage.bedmessage='测试',floor_id=1,patient.checkindate='2030-12-31',patient.checkenddate='2006-10-02'where patient.fileno=bedmanage.fileno and patient.fileno=20000613;
当然我这里的checkindate是date类型的,我的MySQL数据库是8.0的,工具是workbench8.0。
本文分享了在使用SQL语句时,如何正确地插入date类型数据,避免因格式错误导致的常见问题。通过实例演示,展示如何用单引号括起日期字符串,确保数据能被正确识别和存储。
2337

被折叠的 条评论
为什么被折叠?



