gpt4 book ai didi

sql-server-2005 - 在更新: Cannot insert duplicate key row in object 'dbo.tblRelatie' with unique index 'idxRelatiesoortRelatiecode' 行时

转载 作者:行者123 更新时间:2023-12-05 00:37:33 25 4
gpt4 key购买 nike

当更新一行时,出现上述错误。 idxRelatiesoortRelatiecodefldRelatieSoortfldRelatieSoort组成,两者的组合在表中仅存在一次。

那么,该错误的原因可能是什么呢?

更新
这是更新脚本

UPDATE [SQL].[MyDatabase].dbo.tblRelatie SET 
fldNaam = 'De heer A. Removed',
fldAdres = 'Removed 12',
fldPostcode = '1234 AA', fldPlaats = 'Removed',
fldCorrespondentieAdres = 'Removed 12',
fldCorrespondentieAdresPostcode = '1234 AA',
fldCorrespondentieAdresPlaats = 'Removed',
fldRelatieSoort = 1,
fldRelatiecode = 907534,
fldCorrespondentieAdresLandID = 1, fldMobieleTelefoon = '', fldTelefoon = '', fldFax = '', fldEmail = '', fldWebsiteUrl = '', fldBankrekeningnummer = '', fldNaamRekeninghouder = '',
fldPlaatsRekeninghouder = '', fldKrediettermijn = 30, fldLandID = 1
WHERE fldRelatieID =1507;

这是idxRelatiesoortRelatiecode:
CREATE UNIQUE NONCLUSTERED INDEX [idxRelatiesoortRelatiecode] 
ON [dbo].[tblRelatie]
(
[fldRelatieSoort] ASC,
[fldRelatiecode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]

最佳答案

错误消息中没有太多歧义:您在某处设置重复项

  • 二者之一:该组合已经存在,您正尝试将其再次插入
  • 或:它不存在,并且您要使用
  • 相同的组合更新多行

    或重叠:
  • 该组合已经存在,并且您要使用相同的组合
  • 更新多行

    除非索引等错误...

    关于sql-server-2005 - 在更新: Cannot insert duplicate key row in object 'dbo.tblRelatie' with unique index 'idxRelatiesoortRelatiecode' 行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6744683/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com