插入datetime字段,不使用单引号插入不成功
insert into tb_shop(owner_id,area_id,shop_category_id,shop_name,shop_desc,shop_addr,phone,shop_img,priority, create_time,last_edit_time,enable_status,advice) values (1, 4, 1, 111, 123, 2222, 3333, null, null, 2022-04-14 22:02:07.913, 2022-04-14 22:02:09.769, 0, null)
报错:
1064 - 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 '22:02:07.913, 2022-04-14 22:02:09.769, 0, null)' at line 1, Time: 0.000000s
改成这种就可以成功:insert into tb_shop(owner_id,area_id,shop_category_id,shop_name,shop_desc,shop_addr,phone,shop_img,priority, create_time,last_edit_time,enable_status,advice) values (1, 4, 1, 111, 123, 2222, 3333, null, null, '2022-04-14 22:02:07.913', '2022-04-14 22:02:09.769', 0, null)
求帮忙答疑,谢谢
引号必须要加的, 否则会先识别为算术式2022-04,然后碰到04,就出错了。