我知道表中的第305条数据需要删除,但不知道这一条的内容,该如何删除表中的第305条数据

解决方案 »

  1.   

    有没有什么索引ID?有的话delete from tablename  where id=305
      

  2.   

    没有就插入一列自增长ID int indentity(1,1)
      

  3.   

    顶楼上.select id = identity(int,1,1),* into t from tb
    delete from t where id = 305
      

  4.   

    select min(ID) from table_name where id not in (select top 304 id from table_name order by id) order by id 
    这样可以查出第305条记录的内容
      

  5.   


    alter table cz add id1 int identity(1,1)
    delete cz where id1='305'
      

  6.   

    declare @a table (id int identity(1,1),a varchar(100))
    insert @a (a) select name from syscolumns
    select * from @a
    declare @id intdeclare cur_sor cursor scroll for
    select id from @a
    open cur_sor
    fetch absolute 305 from cur_sor into @id
    delete from @a where id=@idselect * from @a
    close cur_sor
    deallocate cur_sor
      

  7.   


    select min(ID)from ee where id not in (select top 304 id from ee order by id)
      

  8.   

    如果没有pk列,就只能像楼上说的,加一个identity字段再删了。
    有pk列就简单了,找到是哪个pk,直接delete就可以
      

  9.   


    顶 zzxiaoma(小马)alter table cz add id int identity(1,1)
    delete cz where id='305'