当前位置: 代码迷 >> Sql Server >> 跪求答案:求一条update语句解决方案
  详细解决方案

跪求答案:求一条update语句解决方案

热度:25   发布时间:2016-04-27 16:00:53.0
跪求答案:求一条update语句
You   need   to   modify   the   information   of   the   columns   of   CompanyName   and   ContactName.   The   data   are   required   to   be   different   for   each   record.   For   example,   the   company   name   is   Company1   for   the   first   record,   Company2   for   the   second   record,   Company3   for   the   third   record,   and   so   on.  

大侠帮忙啊!

------解决方案--------------------
declare @t table(CompanyName varchar(100))
insert @t select 'CompanyName3 '
union all select 'CompanyName8 '
union all select 'CompanyName11 '
union all select 'CompanyName98 '
union all select 'CompanyName56 '
union all select 'CompanyName3 '
union all select 'CompanyName7 '
union all select 'CompanyName1 '

select * from @t

declare @i int
set @i=0
update @t set CompanyName= 'CompanyName '+cast(@i as varchar),@[email protected]+1

select * from @t
  相关解决方案