SQL 分组产生序号
update x set x.HiddenNo=‘TT‘+CONVERT(varchar(12),y.GenTime,112)+RIGHT(‘0000‘+CAST(Y.Rw AS nvarchar(50)),4) from XXXXXXAAAAAA x join ( select a.Guid,a.GenTime, ROW_NUMBER() OVER(partition by ‘XCYH‘+CONVERT(varchar(12),a.GenTime,112) ORDER BY a.GenTime ) Rw from XXXXXXAAAAAA a join XXXXXXBBBBB b on a.Guid=b.Guid where HiddenNo is null) y on x.Guid=y.Guid