SQLSTATE[22007]:无效的日期时间格式:1366 不正确的整数值:Laravel 中的“column_name" [英] SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'column_name' in Laravel

查看:110
本文介绍了SQLSTATE[22007]:无效的日期时间格式:1366 不正确的整数值:Laravel 中的“column_name"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

并行多数据插入错误

SQLSTATE [22007]:无效的日期时间格式:1366错误的整数值:第2行"unit_id"列的SQL(SQL:插入到 product_prices ( created_at product_id unit_id updated_at )值(2016-12-06 06:56:01,27,1,2016-12-06 06:56:01),(2016-12-06 06:56:01,27,,2016-12-06 06:56:01))

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'unit_id' at row 2 (SQL: insert into product_prices (created_at, product_id, unit_id, updated_at) values (2016-12-06 06:56:01, 27, 1,2016-12-06 06:56:01), (2016-12-06 06:56:01,27, , 2016-12-06 06:56:01))

但是我在 nullable(); 中的 unit_id 字段请有人帮我在这里 column_name = unit_id

But my unit_id field in nullable(); Please someone help me Here column_name=unit_id

推荐答案

null 与不存在不同.如果要将null设置为值,则必须在查询中写入它:

null is different than not existend. If you want to set null as a value you have to write it in your query:

 ... ('2016-12-06 06:56:01',27, null, '2016-12-06 06:56:01'))

日期时间格式也错误.您必须将其输入为字符串.

Also the datetime format is wrong. You have to enter it as a string.

这篇关于SQLSTATE[22007]:无效的日期时间格式:1366 不正确的整数值:Laravel 中的“column_name"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆