问题:当新增会员档案时,提示不能从T_ECC_MEMBER_L插入重复键值;
解决方法:
/*查询异常档案资料的最小主键id(开头都是100002),并且找出正常单据最大的id,插入临时表,2553587是最大正常单据的fid*/
/*把正确的id查询出来插入临时表*/
select fpkid,2553587+ROW_NUMBER() over(order by fpkid) xuhao
into memberl
from T_ECC_MEMBER_L where fpkid like '100002%'
/*更新*/
update a set a.fpkid=xuhao From T_ECC_MEMBER_L a
inner join memberl b on a.FPKID=b.fpkid
select * From T_ECC_MEMBER_L where fpkid not like '100002%'