update [dbo].[Supplier] set SysCode=b.SysCode from (select 'GYS'+right(1000000+ROW_NUMBER() over(order by id),6) SysCode,ID from [dbo].[Supplier])bwhere [dbo].[Supplier].ID=b.ID