我来解释一下:--这句照原样: select top 1300 identity(int,1,1) as id into #t from sysobjects A,sysobjects B--这句中的tab改成你的表的名字,intfield改成你要添加1-1300的数字的字段。 insert tab (intfield) select id from #t order by id--这句照原样: drop table #t执行后,打开你的表看看。
可以直接把如下语句在查询分析器执行看看:create table test(ord int,name nvarchar(8)) select top 1300 identity(int,1,1) as id into #t from sysobjects A,sysobjects B insert test(ord) select id from #t order by id drop table #t select * from test 另请教J老师,若楼主的意思是: 原表中已有N条记录,然后需从头开始将某字段的值改为1-1300呢
insert tab(intfield) select id from #t order by id
drop table #t
select top 1300 identity(int,1,1) as id into #t from sysobjects A,sysobjects B--这句中的tab改成你的表的名字,intfield改成你要添加1-1300的数字的字段。
insert tab (intfield) select id from #t order by id--这句照原样:
drop table #t执行后,打开你的表看看。
select top 1300 identity(int,1,1) as id into #t from sysobjects A,sysobjects B
insert test(ord) select id from #t order by id
drop table #t
select * from test
另请教J老师,若楼主的意思是:
原表中已有N条记录,然后需从头开始将某字段的值改为1-1300呢