找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 4168|回复: 5

[数据库知识] 在线等解决通升u851普及版过程提示这东西

[复制链接]
发表于 2010-2-5 08:56:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
数据库名: UFDATA_002_2007
应收应付数据, DATA2_AP
错误信息:
-2147217873
违反了 PRIMARY KEY 约束 'PK_VoucherNumber'。不能在对象 'VoucherNumber' 中插入重复键。
执行如下语句时出错:
--预置单据编号
DECLARE @bRemote VARCHAR(10)
DECLARE @RemoteID Varchar(2)
DECLARE @ID int
Set @bRemote=(SELECT Upper(cValue) FROM Accinformation Where cName='bRemote')
IF @bRemote ='TRUE'
Set @RemoteID=(SELECT Isnull(cValue,'') FROM Accinformation Where cName='cID')
ELSE
Set @RemoteID=''
IF NOT EXISTS (Select CardNumber From VoucherNumber Where AppName='应收' and CardNumber='R0')
BEGIN
  insert into VoucherNumber (AppName,CardNumber,CardName) values('应收','R0','其他应收单')
  set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AR' and cType='R0')
  IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('R0',@ID)
END
IF NOT EXISTS (Select CardNumber From VoucherNumber Where AppName='应付' and CardNumber='P0')
BEGIN
  insert into VoucherNumber (AppName,CardNumber,CardName) values('应付','P0','其他应付单')
  set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AP' and cType='P0')
  IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('P0',@ID)
END
IF NOT EXISTS (Select CardNumber From VoucherNumber Where AppName='应收' and CardNumber='RR')
IF @bRemote='TRUE'
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName,iSize,dStartDate,Prefix1,Prefix1Len)
   values('应收','RR','收款单',10,getdate(),'远程号',2)
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AR' and cType='R')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('RR',@ID)
  END
ELSE
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName) values('应收','RR','收款单')
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AR' and cType='R')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('RR',@ID)
  END
IF NOT EXISTS (Select CardNumber From VoucherNumber Where AppName='应收' and CardNumber='RP')
IF @bRemote='TRUE'
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName,iSize,dStartDate,Prefix1,Prefix1Len)
   values('应收','RP','付款单',10,getdate(),'远程号',2)
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AR' and cType='P')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('RP',@ID)
  END
ELSE
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName) values('应收','RP','付款单')
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AR' and cType='P')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('RP',@ID)
  END
IF NOT EXISTS (Select CardNumber From VoucherNumber Where AppName='应付' and CardNumber='PP')
IF @bRemote='TRUE'
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName,iSize,dStartDate,Prefix1,Prefix1Len)
   values('应付','PP','付款单',10,getdate(),'远程号',2)
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AP' and cType='P')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('PP',@ID)
  END
ELSE
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName) values('应付','PP','付款单')
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AP' and cType='P')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('PP',@ID)
  END
IF NOT EXISTS (Select CardNumber From VoucherNumber Where AppName='应付' and CardNumber='PR')
IF @bRemote='TRUE'
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName,iSize,dStartDate,Prefix1,Prefix1Len)
   values('应付','PR','收款单',10,getdate(),'远程号',2)
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AP' and cType='R')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('PR',@ID)
  END
ELSE
  BEGIN
   insert into VoucherNumber (AppName,CardNumber,CardName) values('应付','PR','收款单')
   set @ID=(select Max(iCancelNo) From Ap_CancelNo Where cFlag='AP' and cType='R')
   IF @ID is not null insert into VoucherHistory (CardNumber,cNumber) values('PR',@ID)
  END
 楼主| 发表于 2010-2-5 16:35:55 | 显示全部楼层
救命啊来帮助下嘛我晕了啊
 楼主| 发表于 2010-2-5 22:25:13 | 显示全部楼层
自己顶下快来人帮看看啊
 楼主| 发表于 2010-2-6 13:15:02 | 显示全部楼层
自己顶下快来人帮看看啊
  • 打卡等级:无名新人
  • 打卡总天数:1
  • 打卡月天数:1
  • 打卡总奖励:1
  • 最近打卡:2024-11-16 13:44:27
发表于 2012-5-8 11:57:06 | 显示全部楼层
今天也碰到这个问题了,baidu到了这个帖子,不发新贴了,只顶一下
回复 点赞 拍砖

使用道具 举报

  • 打卡等级:无名新人
  • 打卡总天数:1
  • 打卡月天数:1
  • 打卡总奖励:3
  • 最近打卡:2024-11-15 09:24:31
发表于 2012-8-27 21:26:34 | 显示全部楼层
在当前年度库执行以下脚本即可
delete From VoucherNumber Where CardName in  ('其他应收单','其他应付单','付款单','收款单')

升级交流:15098071459
回复 点赞 拍砖

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-11-27 08:20 , Processed in 0.042385 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表