<legend id='X75T8'><style id='X75T8'><dir id='X75T8'><q id='X75T8'></q></dir></style></legend>
    • <bdo id='X75T8'></bdo><ul id='X75T8'></ul>

      <small id='X75T8'></small><noframes id='X75T8'>

      <i id='X75T8'><tr id='X75T8'><dt id='X75T8'><q id='X75T8'><span id='X75T8'><b id='X75T8'><form id='X75T8'><ins id='X75T8'></ins><ul id='X75T8'></ul><sub id='X75T8'></sub></form><legend id='X75T8'></legend><bdo id='X75T8'><pre id='X75T8'><center id='X75T8'></center></pre></bdo></b><th id='X75T8'></th></span></q></dt></tr></i><div id='X75T8'><tfoot id='X75T8'></tfoot><dl id='X75T8'><fieldset id='X75T8'></fieldset></dl></div>

        <tfoot id='X75T8'></tfoot>

        SQL Server 错误 1934 发生在 INSERT 到带有计算列 PH

        时间:2023-09-20
        <legend id='WA8PQ'><style id='WA8PQ'><dir id='WA8PQ'><q id='WA8PQ'></q></dir></style></legend><tfoot id='WA8PQ'></tfoot>

        <small id='WA8PQ'></small><noframes id='WA8PQ'>

        <i id='WA8PQ'><tr id='WA8PQ'><dt id='WA8PQ'><q id='WA8PQ'><span id='WA8PQ'><b id='WA8PQ'><form id='WA8PQ'><ins id='WA8PQ'></ins><ul id='WA8PQ'></ul><sub id='WA8PQ'></sub></form><legend id='WA8PQ'></legend><bdo id='WA8PQ'><pre id='WA8PQ'><center id='WA8PQ'></center></pre></bdo></b><th id='WA8PQ'></th></span></q></dt></tr></i><div id='WA8PQ'><tfoot id='WA8PQ'></tfoot><dl id='WA8PQ'><fieldset id='WA8PQ'></fieldset></dl></div>
          <bdo id='WA8PQ'></bdo><ul id='WA8PQ'></ul>

                    <tbody id='WA8PQ'></tbody>
                1. 本文介绍了SQL Server 错误 1934 发生在 INSERT 到带有计算列 PHP/PDO 的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 SQL Server 2005 中向表中添加计算列后,我在 INSERT 上收到以下消息,仅通过 PHP(使用 PDO)它在 SQL Server Management Studio 中工作正常.

                  After adding a computed column to a table in SQL Server 2005 I am getting the following message on INSERT, only via PHP (using PDO) it's working fine in SQL Server Managment Studio.

                  为了确保一切正确,我使用 SQL Server Profiler 设置了跟踪并将 INSERT 语句复制/粘贴到 SQL Server Management Studio.它在 SSMS 中运行良好,但在 PHP 中继续失败.

                  To ensure I had everything correct I setup a trace with SQL Server Profiler and copy/pasted the INSERT statement into SQL Server Managment Studio. It ran just fine in SSMS, but continues to fail in PHP.

                  添加联系人时出错:SQLSTATE[HY000]:一般错误:1934 一般 SQL服务器错误:检查来自 SQL Server [1934] 的消息(严重性 16)[(空)]

                  Error adding contact: SQLSTATE[HY000]: General error: 1934 General SQL Server error: Check messages from the SQL Server [1934] (severity 16) [(null)]

                  推荐答案

                  原来问题与 SET 参数有关.我使用了从 这里.确定在 SQL Server Management Studio(插入工作的地方)中设置了哪些选项.然后在我的插入语句之前将每个放在 exec 中导致事情再次工作.我不需要保留所有选项,所以下面我展示了使其工作所需的选项.

                  Turns out the problem had to do with the SET parameters. I used the code below obtained from Here. To determine which options were set in SQL Server Management Studio (where the insert worked). Then placing each of those in an exec prior to my insert statement caused things to work again. I didn't need to keep all the options, so below I show the ones which were required to get it working.

                  DECLARE @options INT
                  SELECT @options = @@OPTIONS
                  
                  PRINT @options
                  IF ( (1 & @options) = 1 ) PRINT 'DISABLE_DEF_CNST_CHK' 
                  IF ( (2 & @options) = 2 ) PRINT 'IMPLICIT_TRANSACTIONS' 
                  IF ( (4 & @options) = 4 ) PRINT 'CURSOR_CLOSE_ON_COMMIT' 
                  IF ( (8 & @options) = 8 ) PRINT 'ANSI_WARNINGS' 
                  IF ( (16 & @options) = 16 ) PRINT 'ANSI_PADDING' 
                  IF ( (32 & @options) = 32 ) PRINT 'ANSI_NULLS' 
                  IF ( (64 & @options) = 64 ) PRINT 'ARITHABORT' 
                  IF ( (128 & @options) = 128 ) PRINT 'ARITHIGNORE'
                  IF ( (256 & @options) = 256 ) PRINT 'QUOTED_IDENTIFIER' 
                  IF ( (512 & @options) = 512 ) PRINT 'NOCOUNT' 
                  IF ( (1024 & @options) = 1024 ) PRINT 'ANSI_NULL_DFLT_ON' 
                  IF ( (2048 & @options) = 2048 ) PRINT 'ANSI_NULL_DFLT_OFF' 
                  IF ( (4096 & @options) = 4096 ) PRINT 'CONCAT_NULL_YIELDS_NULL' 
                  IF ( (8192 & @options) = 8192 ) PRINT 'NUMERIC_ROUNDABORT' 
                  IF ( (16384 & @options) = 16384 ) PRINT 'XACT_ABORT'
                  

                  以下是我最终需要的选项:

                  Here are the options I ended up needing:

                  $dbPDO->exec("SET ANSI_WARNINGS ON");                                                                               
                  $dbPDO->exec("SET ANSI_PADDING ON");
                  $dbPDO->exec("SET ANSI_NULLS ON");
                  $dbPDO->exec("SET QUOTED_IDENTIFIER ON");
                  $dbPDO->exec("SET CONCAT_NULL_YIELDS_NULL ON");
                  

                  更新:似乎 FK 约束导致了以下错误.以上也修复了这个错误.

                  Update: It seems FK constraints resulted in the following error. The above fixed this error as well.

                  SQLSTATE[HY000]:一般错误:8624 一般 SQL Server 错误:检查来自 SQL Server 的消息 [8624](严重性 16)[(null)]

                  SQLSTATE[HY000]: General error: 8624 General SQL Server error: Check messages from the SQL Server [8624] (severity 16) [(null)]

                  这篇关于SQL Server 错误 1934 发生在 INSERT 到带有计算列 PHP/PDO 的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 PHP PDO MYSQL 中插入多行的最佳方法是什么? 下一篇:使用 PDO 准备参数化查询

                  相关文章

                  最新文章

                2. <legend id='w5iye'><style id='w5iye'><dir id='w5iye'><q id='w5iye'></q></dir></style></legend>

                    <small id='w5iye'></small><noframes id='w5iye'>

                  1. <tfoot id='w5iye'></tfoot>

                        <bdo id='w5iye'></bdo><ul id='w5iye'></ul>
                      <i id='w5iye'><tr id='w5iye'><dt id='w5iye'><q id='w5iye'><span id='w5iye'><b id='w5iye'><form id='w5iye'><ins id='w5iye'></ins><ul id='w5iye'></ul><sub id='w5iye'></sub></form><legend id='w5iye'></legend><bdo id='w5iye'><pre id='w5iye'><center id='w5iye'></center></pre></bdo></b><th id='w5iye'></th></span></q></dt></tr></i><div id='w5iye'><tfoot id='w5iye'></tfoot><dl id='w5iye'><fieldset id='w5iye'></fieldset></dl></div>