declare
@aa
int
set @aa = 1
update EWC_HT_Contract set ContractCode = a.ContractCode + cast ( @aa as nvarchar ( 10 )), @aa = @aa + 1
from
(
select ContractCode from Contract
WHERE (MasterID = 1 )
) as a
where MasterID = 2
set @aa = 1
update EWC_HT_Contract set ContractCode = a.ContractCode + cast ( @aa as nvarchar ( 10 )), @aa = @aa + 1
from
(
select ContractCode from Contract
WHERE (MasterID = 1 )
) as a
where MasterID = 2
SQL Server 2000 里面的通过记录修改另一条记录地方法,还可以修改序号。