比如:
select identity(int,1,1) as id,* into #temp from tabeldelete from #temp where id=4

解决方案 »

  1.   

    嘿嘿! 在临时表里面取TABLE1的ID删除就是了!
      

  2.   

    delete from TableName where (你要删除行的查询条件)
      

  3.   

    alter table add cloumns id identity(1,1)
    delete from table where id=n
      

  4.   

    --删除某一行其中id为主键
    declare @x int,@sql varchar(8000)
    set @x=11
    set @sql='delete  jobs  where job_id in('+
    'select job_id
    from  (select  top '+cast(@x as varchar(4)) +' job_id 
    from  jobs)  aa  
    where  not  exists
    (select  1  from '+ 
    '(select  top '+ cast(@x-1 as varchar(4))  +' job_id  
    from  jobs)  bb  where  aa.job_id=bb.job_id))'
    exec(@sql)
      

  5.   

    你可以:SET ROWCOUNT 10
    delete 表只删前10条
      

  6.   

    SET ROWCOUNT 1
    delete from 表
    where  主键 not in (
       select top n-1 主键 from 表
    )
      

  7.   

    多谢,我是想要删除第N行,不是前N 行,
    可以看看我的这个问题吗?
    http://expert.csdn.net/Expert/TopicView1.asp?id=2488838
    我是想在VC的程序中做这件事情,现在竟然创建表出问题了
      

  8.   

    是可以用游标实现啊。如下面:
    declare state_cursor cursor scroll for 你的sql语句,
    open state_cursor
    FETCH relative 你要删除的行号 from state_cursor --移动到你所要删除的行号
    然后取出关键字了,再在表中的where语句中写上关键字,可以试试。
      

  9.   

    declare @t1 table (id int)
    declare @t2 table (id int)
    insert @t1 select top 3 id  from test_1
    insert @t2 select top 2 id  from test_1
    delete from test_1 t where t.id =(select id from  @t1 t1 where id not in (select id from @t2))