--销售订单ID
Use 有问题的年度帐套号
declare @a int
declare @b int
declare @c int
declare @d nvarchar(20)
set @a=(select max(cast(right(isosid,7) as int)) from so_sodetails)
set @b=(select max(cast(right(autoid,7) as int)) from so_sodetails)
set @c=(select max(cast(right(id,7) as int)) from so_somain)
set @d=(select ltrim(rtrim(substring(name,8,3))) from master..sysdatabases where dbid=(select db_id()))
print @a
print @b
print @c
update ufsystem..ua_identity
set ifatherid=@c,
ichildid=(case when @a>@b then @a else @b end)
where cvouchtype='somain' and cacc_id=''+@d+''
--修改发货单ID
use
有问题的年度帐套号
declare @a int
declare @b int
declare @c int
declare @d nvarchar(20)
set @a=(select max(cast(right(autoid,7) as int)) from dispatchlists)
set @b=(select max(cast(right(idlsid,7) as int)) from dispatchlists)
set @c=(select max(cast(right(dlid,7) as int)) from dispatchlist)
set @d=(select ltrim(rtrim(substring(name,8,3))) from master..sysdatabases where dbid=(select db_id()))
print @a
print @b
print @c
update ufsystem..ua_identity
set ifatherid=@c,
ichildid=(case when @a>@b then @a else @b end)
where cvouchtype='dispatch ' and cacc_id=''+@d+''
|