<legend id='f0DnJ'><style id='f0DnJ'><dir id='f0DnJ'><q id='f0DnJ'></q></dir></style></legend>

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

      • <bdo id='f0DnJ'></bdo><ul id='f0DnJ'></ul>

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

      <tfoot id='f0DnJ'></tfoot>

    1. INSERT 语句与 FOREIGN KEY 约束冲突 - SQL Server

      时间:2023-07-18

        <legend id='CILC4'><style id='CILC4'><dir id='CILC4'><q id='CILC4'></q></dir></style></legend>

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

        • <small id='CILC4'></small><noframes id='CILC4'>

        • <tfoot id='CILC4'></tfoot>
            <tbody id='CILC4'></tbody>
                本文介绍了INSERT 语句与 FOREIGN KEY 约束冲突 - SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我收到以下错误.你能帮我吗?

                I am getting the following error. Could you please help me?

                消息 547,级别 16,状态 0,第 1 行
                INSERT 语句与 FOREIGN KEY 约束FK_Sup_Item_Sup_Item_Cat"冲突.冲突发生在数据库dev_bo"、表dbo.Sup_Item_Cat"中.声明已终止.

                Msg 547, Level 16, State 0, Line 1
                The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Sup_Item_Sup_Item_Cat". The conflict occurred in database "dev_bo", table "dbo.Sup_Item_Cat". The statement has been terminated.

                代码:

                insert into sup_item (supplier_id, sup_item_id, name, sup_item_cat_id, 
                                      status_code, last_modified_user_id, last_modified_timestamp, client_id)   
                values (10162425, 10, 'jaiso', '123123',
                        'a', '12', '2010-12-12', '1062425')
                

                最后一列 client_id 导致错误.我试图将 dbo.Sup_Item_Cat 中已经存在的值放入列中,对应于 sup_item.. 但没有喜悦 :-(

                The last column client_id is causing the error. I tried to put the value which already exists in the dbo.Sup_Item_Cat into the column, corresponding to the sup_item.. but no joy :-(

                推荐答案

                在您的表 dbo.Sup_Item_Cat 中,它有一个指向另一个表的外键引用.FK 的工作方式是,它不能在该列中具有不在引用表的主键列中的值.

                In your table dbo.Sup_Item_Cat, it has a foreign key reference to another table. The way a FK works is it cannot have a value in that column that is not also in the primary key column of the referenced table.

                如果您有 SQL Server Management Studio,请打开它并sp_help 'dbo.Sup_Item_Cat'.查看 FK 位于哪一列,以及它引用哪个表的哪一列.您插入了一些错误数据.

                If you have SQL Server Management Studio, open it up and sp_help 'dbo.Sup_Item_Cat'. See which column that FK is on, and which column of which table it references. You're inserting some bad data.

                如果您需要更好的解释,请告诉我!

                Let me know if you need anything explained better!

                这篇关于INSERT 语句与 FOREIGN KEY 约束冲突 - SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:ROWNUM 如何在分页查询中工作? 下一篇:表命名困境:单数与复数名称

                相关文章

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

                <legend id='Gtqqt'><style id='Gtqqt'><dir id='Gtqqt'><q id='Gtqqt'></q></dir></style></legend>

                    <bdo id='Gtqqt'></bdo><ul id='Gtqqt'></ul>

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