Mon - Fri : 09:00 - 18:00 北京市丰台区金唐中心C座10层

扫码访问手机版

手机扫描下载App客户端

电话: 400 633 9585
返回顶部
BS3000+系统中,有个别几张单据验收的时候提示:key violation 违反了primary key约...
显示全部楼层 倒序浏览 927次阅读 6次回复

欢迎来到星创云技术支持社区,马上注册,享更多服务。 公众号:bjxcyun

您需要 登录 才可以下载或查看,没有账号?立即注册

x
BS3000+系统中,有个别几张单据验收的时候提示:key violation 违反了primary key约束pk_spkcb不能在对象spkcb中插入重复键,处理方法。

单据明细里检查一下CKDM,SPDM,GG1DM,GG2DM中是否有空格之类的,这个约束和这四个字段有关。可用SQL语句进行更新。可用RTRIM(去除右空格)和LTRIM(去除左空格)来进行更新。

部分脚本文件

delete from savedetail
declare  @TableName sysname
              ,@ExecStr      nvarchar(4000)

declare GetTableName cursor  for select distinct ob.name from syscolumns as co, sysobjects as ob where co.id = ob.id and co.name = 'SPDM'  
                                                                                                                                                                                    and ob.xtype = 'U'
open GetTableName
fetch next from  GetTableName  into @TableName
while @@fetch_status = 0
begin
  set @ExecStr = 'update ' + @TableName + '  set SPDM = LTrim(RTrim(SPDM))'
  execute sp_executesql   @ExecStr
  fetch next from  GetTableName  into @TableName
end
close GetTableName
deallocate GetTableName
GO
declare  @TableName sysname
              ,@ExecStr      nvarchar(4000)

declare GetTableName cursor  for select distinct ob.name from syscolumns as co, sysobjects as ob where co.id = ob.id and co.name = 'GG1DM'  
                                                                                                                                                                                    and ob.xtype = 'U'
open GetTableName
fetch next from  GetTableName  into @TableName
while @@fetch_status = 0
begin
  set @ExecStr = 'update ' + @TableName + '  set GG1DM = LTrim(RTrim(GG1DM))'
  execute sp_executesql   @ExecStr
  fetch next from  GetTableName  into @TableName
end
close GetTableName
deallocate GetTableName
GO


declare  @TableName sysname
              ,@ExecStr      nvarchar(4000)

declare GetTableName cursor  for select distinct ob.name from syscolumns as co, sysobjects as ob where co.id = ob.id and co.name = 'GG2DM'  
                                                                                                                                                                                    and ob.xtype = 'U'
open GetTableName
fetch next from  GetTableName  into @TableName
while @@fetch_status = 0
begin
  set @ExecStr = 'update ' + @TableName + '  set GG2DM = LTrim(RTrim(GG2DM))'
  execute sp_executesql   @ExecStr
  fetch next from  GetTableName  into @TableName
end
close GetTableName
deallocate GetTableName
GO

update GUIGE1
set GGDM=LTrim(RTrim(GGDM))
update GUIGE2
set GGDM=LTrim(RTrim(GGDM))



商品代码空格处理.rar

504 Bytes, 下载次数: 5

BS3000+

星创云-百胜软件伙伴_技术支持官网www.erplt.com
gxg商城

2013-7-25 13:04:39

百胜软件知识学习中,强列支持,共同进步
星创云-百胜软件伙伴_技术支持官网www.erplt.com
erp用户

2013-7-25 14:24:10

这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
bjtom

2013-7-25 14:44:06

大家都很热心嘛,遇到问题也不着急了,在这找找可以找到解决方法。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
tomw

2013-7-25 16:51:18

这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com

精彩评论6

gxg商城

2013-7-25 13:04:39

百胜软件知识学习中,强列支持,共同进步
星创云-百胜软件伙伴_技术支持官网www.erplt.com
erp用户

2013-7-25 14:24:10

这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
bjtom

2013-7-25 14:44:06

大家都很热心嘛,遇到问题也不着急了,在这找找可以找到解决方法。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
tomw

2013-7-25 16:51:18

这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
这些问题用上面的方法解决了,支持一下。
星创云-百胜软件伙伴_技术支持官网www.erplt.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 京ICP备2021034942号-2 |

    京公网安备 11010602104274号

    |北京星创云科技有限公司