简体   繁体   English

SQLSTATE [HY000]:一般错误:20018 '=' 附近的语法不正确

[英]SQLSTATE[HY000]: General error: 20018 Incorrect syntax near '='

I'm getting a strange error in a Laravel project I'm working on.我正在处理的 Laravel 项目中出现了一个奇怪的错误。

SQLSTATE[HY000]: General error: 20018 Incorrect syntax near '='. SQLSTATE [HY000]:一般错误:20018 '=' 附近的语法不正确。 [20018] (severity 15) [(null)] (SQL: update [plan_part] set [is_corrosion_protection_required] = 0, [modified_date] = 2018-01-24 11:47:03 where [plan_part_id] = 131996) [20018](严重性 15)[(空)](SQL:更新 [plan_part] 设置 [is_corrosion_protection_required] = 0,[modified_date] = 2018-01-24 11:47:03 其中 [plan_part_id] = 131996)

It is happening on my test server, but locally it is working.它发生在我的测试服务器上,但在本地它正在运行。 The test server is running PHP 7.1.10 and the localhost is WAMP running 7.0.10.测试服务器运行 PHP 7.1.10,本地主机是运行 7.0.10 的 WAMP。

I don't understand why this is causing an error.我不明白为什么这会导致错误。 The syntax appears to be correct.语法似乎是正确的。 I'm just using Laravel's eloquent model to save to the database, which I'm pretty sure is just a PHP PDO bound parameter statement.我只是使用 Laravel 的 eloquent model 保存到数据库,我很确定这只是一个 PHP PDO 绑定参数语句。

Strangely, I am able to save on the test server if I tweak a different property other than is_corrosion_protection_required .奇怪的是,如果我调整is_corrosion_protection_required以外的其他属性,我可以在测试服务器上保存。 That property is a bit property in the DB.该属性是数据库中的一个bit属性。 I tried changing it to use true/false, 1/0, '1'/'0' and 'yes'/'no', but it didn't fix anything.我尝试将其更改为使用真/假、1/0、“1”/“0”和“是”/“否”,但它没有解决任何问题。

I am getting the same problem on another bit field, so I think it has to do with that, but I have no idea what I need to do or where to go from here.我在另一个位域上遇到了同样的问题,所以我认为这与此有关,但我不知道我需要做什么或从这里到 go 的位置。

Hoping someone can provide some clues as to what else I can try or what I need to do to get this working on both localhost and the test server.希望有人能提供一些线索,说明我还可以尝试什么,或者我需要做什么才能在本地主机和测试服务器上运行。

I don't think the more updated 7.1 version is a major problem, but I don't know much about server administration.我不认为更新更多的7.1版本是一个主要问题,但我对服务器管理了解不多。

After many hours of research, I was able to come to the conclusion that our problem was not with the original query that is outlined in the error message. 经过许多小时的研究,我得出的结论是,我们的问题不是错误消息中概述的原始查询。

There were triggers associated with the table in question and those triggers were potentially the root cause of the problem. 有与该表相关联的触发器,这些触发器可能是问题的根本原因。 I can't say for certain what exactly was throwing the error, but our DBA reviewed the triggers and disabled them causing everything to work again. 我无法确定到底是什么引发了错误,但是我们的DBA审查了触发器并禁用了触发器,导致一切再次正常运行。

Thanks for all the comments and assistance in reviewing my thoughts. 感谢您的所有评论和帮助我回顾自己的想法。

This problem happen from server side not from your project, You need to make sure you are complete and success install sqlsrv and pdo_sqlsrv modules on server.这个问题发生在服务器端而不是你的项目,你需要确保你已经完成并成功地在服务器上安装sqlsrvpdo_sqlsrv模块。

When you run these command pecl install pdo_sqlsrv and pecl install sqlsrv , make sure the process done successful, and you see this message at end of process:当您运行这些命令pecl install pdo_sqlsrvpecl install sqlsrv时,请确保该过程成功完成,并且您会在过程结束时看到此消息:

Build complete.
Don't forget to run 'make test'.

此问题是由字符集引起的!

execute [ iconv(); ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用PDO命名参数会引发错误:SQLSTATE [HY000]:常规错误:“(”附近的1:语法错误 - Using PDO named parameters throws error: SQLSTATE[HY000]: General error: 1 near “(”: syntax error SQLSTATE [HY000]:常规错误:“。”附近为1:UPDATE语句中的语法错误 - SQLSTATE[HY000]: General error: 1 near “.”: syntax error in UPDATE statement Symfony/Doctrine 功能测试使用 sqlite 导致 SQLSTATE[HY000]: 一般错误: 1 near "(": 语法错误 - Symfony/Doctrine functional tests using sqlite leads to SQLSTATE[HY000]: General error: 1 near "(": syntax error SQLSTATE [HY000]:常规错误:1366不正确的整数值: - SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 为什么SQLSTATE [HY000]:一般错误? - Why SQLSTATE[HY000]: General error? yii2 使用 dblib 驱动程序 SQLSTATE[HY000]: General error: 20018 Invalid object name t_user - yii2 use dblib driver SQLSTATE[HY000]: General error: 20018 Invalid object name t_user SQLSTATE [HY000]:一般错误 - SQLSTATE[HY000]: General error SQLSTATE [HY000]:一般错误:2053 - SQLSTATE[HY000]: General error: 2053 SQLSTATE [HY000]:一般错误和array(0){} - SQLSTATE[HY000]: General error and array(0){} 我不断收到数据库错误错误:SQLSTATE [HY000]:常规错误:1366不正确的整数值 - I keep getting Database Error Error: SQLSTATE[HY000]: General error: 1366 Incorrect integer value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM