SQL 在循环内修改字段值
时间:2021-07-01 10:21:17
帮助过:28人阅读
begin
update s set fSO =(Select ‘SR‘ +CONVERT(varchar(100), GETDATE(), 112)+ ‘-‘ +RIGHT(‘0000‘+convert(varchar,@id),4)) from t_Send_Revisit s
inner join (select top 1 * From t_Send_Revisit Where fSO is null ) t on t.SSO=s.SSO and t.STime = s.STime and t.fSNo= s.fSNo and s.CustCode = t.CustCode
set @id=@id+1
end
end
SQL 在循环内修改字段值
标签:sql技巧