我发了一份贴子,内容是:
我很奇怪,sql2000中怎么没有限制列表数目的菜单,所以我用asp在add.asp(增加信息的)后编写了一段程序,却发现我原来认为的.update可以更新所有数据库列表的序号,通过一系测试发现只是更改了单行数据的序号,而不能通过增加一行信息,删除原有第一个信息来更新,听懂我的意思吗?而且我在调试时,把id(有标识)改得乱七八糟,它的序号还要通过删除id列,然后用补充的方法来解决吗?如果这样我对sql有意见...后来有人回答是这样的,有多人认同,但我看不懂je是什么意思,其中内容是这样的:
declare @id as int
select @id=0
update tb set @id=@id+1,je=@id 

解决方案 »

  1.   

    难道是我写的
    declare @id as int 
    select @id=0 
    update tb set @id=@id+1,id=@id 
      

  2.   

    --> 测试数据:@tb
    create table tb(id int identity(1,1) ,[id1] int,[name] varchar(8))
    insert tb
    select 1,'就' union all
    select 2,'看' union all
    select 3,'吵' union all
    select 4,'你' union all
    select 6,'哦' union all
    select 7,'你好' union all
    select 9,'破好看你' union all
    select 10,'你-好'
    select * from tbdeclare @id as int 
    select @id=0 
    update tb set @id=@id+1,id1=@id select * from tb/*
    id          id1         name
    ----------- ----------- --------
    1           1           就
    2           2           看
    3           3           吵
    4           4           你
    5           5           哦
    6           6           你好
    7           7           破好看你
    8           8           你-好(8 行受影响)*/
    id          id1         name
    ----------- ----------- --------
    1           1           就
    2           2           看
    3           3           吵
    4           4           你
    5           5           哦
    6           6           你好
    7           7           破好看你
    8           8           你-好(8 行受影响)自增列不能用,自增列是不允许修改的
    除非 set .....on