怎样用sql语句把一个数字字段的值从小到大update了。(就像自动编号那样,从1开始)
很急,谢谢
------解决方案--------------------select identity(int,1,1) as sn,field1 into #t from t1;
update #t set field1=sn;
------解决方案-------------------- create table #t(id int, ff varchar(10))
insert into #t(ff) select 'a '
insert into #t(ff) select 'b '
insert into #t(ff) select 'c '
declare @i int
set @i=0
update #t set id=@i,@i=@i+1
select * from #t
drop table #t
------解决方案--------------------# 临时表
## 全局临时表