就是一个ID在这个表里只能出现两次,当发现ID里面有2个相同ID值后先删除一个等于这个ID的行!再里表里添加记录

解决方案 »

  1.   

    回复: futulove(福途£爱) 
      插入的时候先判断是否有2条,有的话删除一条,在插入,没有的话直接插入,对就是这样,怎么办
      

  2.   

    case when count(select * from tablename where id=要插入的id)>1 then delete top 1 from tablename where id=要插入的id else 插入
      

  3.   

    case when count(select * from tablename where id=要插入的id)>1 then set rowcount 1 delete from tablename where id=要插入的id  set rowcount 0 else 插入
    这样,那个不好使