总部大师,能不能再帮忙修改一下,现在单据已经可以使用bigint,但是在单据ID达到bigint后,后续再获取ID字段是会报Arithmetic overflow error converting expression to data type int.错误,经过分析发现是在Kingdee.BOS.App.Core.SequenceReader.GetSqlServerSequence方法中的脚本中没有进行int64的判断,导致脚本中定义的表变量字段还是int型,因此会导致以上报错,请帮忙处理,客户无法使用了,急,谢谢!
脚本如下:
DECLARE @icount INT
SET NOCOUNT ON
SET @icount=0
DECLARE @OutIdTable TABLE (Id INT)
DECLARE @lastValue INT
DECLARE @trancount int
set @trancount=@@TRANCOUNT
if @trancount>0
save transaction sp
else
begin transaction
begin try
if @count<=100
begin
WHILE @icount<@count
BEGIN
INSERT INTO Z_CMK_LS_RetailFinE
( Column1 )
VALUES ( 0 -- Column1 - int
);
INSERT INTO @OutIdTable
( Id )
VALUES (SCOPE_IDENTITY());
SET @icount=@icount + 1
END
SELECT id FROM @OutIdTable;
end
else
begin
update Z_CMK_LS_RetailFinE with(tablock) set Column1=Column1;
exec sp_executesql N'insert into Z_CMK_LS_RetailFinE(column1)
select top(@count) 1 from master..spt_values x cross join master..spt_values y',N'@count int',@count=@count;
select id from Z_CMK_LS_RetailFinE with(tablock);
end
if @trancount>0
rollback transaction sp
else
rollback transaction
end try
begin catch
if @trancount>0
rollback transaction sp
else
rollback transaction
declare @errmessage nvarchar(4000)
declare @errserverity int
declare @errstate int
select @errmessage=ERROR_MESSAGE(),@errserverity=ERROR_SEVERITY(),@errstate=ERROR_STATE()
raiserror(@errmessage,@errserverity,@errstate)
end catch
以上脚本中的DECLARE @OutIdTable TABLE (Id INT)修改为DECLARE @OutIdTable TABLE (Id BIGINT)即可
推荐阅读