当前位置:网站首页>mysql插入datetime类型字段不加单引号插入不成功
mysql插入datetime类型字段不加单引号插入不成功
2022-04-23 11:06:00 【CSDN问答】
问题遇到的现象和发生背景
插入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,就出错了。
版权声明
本文为[CSDN问答]所创,转载请带上原文链接,感谢
https://ask.csdn.net/questions/7693290
边栏推荐
- Notes on concurrent programming of vegetables (IX) asynchronous IO to realize concurrent crawler acceleration
- The songbird document editor will be open source: starting with but not limited to markdown
- 闹钟场景识别
- JDBC – PreparedStatement – 如何设置 Null 值?
- 学习 Go 语言 0x08:《Go 语言之旅》中 练习使用 error
- Kaggle - real battle of house price prediction
- Solutions to common problems in visualization (IX) background color
- Constraintlayout layout
- MySQL分区表实现按月份归类
- Use of SVN:
猜你喜欢
一道有趣的阿里面试题
第六站神京门户-------手机号码的转换
Cygwin 中的 rename 用法
Visual common drawing (V) scatter diagram
Excel · VBA custom function to obtain multiple cell values
Excel · VBA array bubble sorting function
A diary of dishes | 238 Product of arrays other than itself
Typora operation skill description (I) md
ConstraintLayout布局
升级cpolar内网穿透能获得的功能
随机推荐
CUMCM 2021-B:乙醇偶合制備C4烯烴(2)
Data analysis learning (I) data analysis and numpy Foundation
The songbird document editor will be open source: starting with but not limited to markdown
Software testers, how to mention bugs?
An interesting interview question
26. 删除有序数组中的重复项
一个微博数据库设计带来的简单思考
@valid,@Validated 的学习笔记
Strongest date regular expression
Mysql中一千万条数据怎么快速查询
UDP basic learning
Esp32 learning - add folder to project
使用zerotier让异地设备组局域网
Cygwin 中的 rename 用法
Visualized common drawing (II) line chart
web三大组件(Servlet,Filter,Listener)
Solutions to common problems in visualization (VIII) solutions to problems in shared drawing area
MBA-day5数学-应用题-工程问题
JDBC – PreparedStatement – 如何设置 Null 值?
Visual Road (XII) detailed explanation of collection class