我在程序中构建了一个数组,里面存的就是要删除记录的索引,该怎么传给存储过程呢,因为数据可能会很多,所以拼字符串然后用IN(...)的方法删除好像不太行

解决方案 »

  1.   

    或許可以將其一條條insert into #t
    然後刪除的時候join #t就可以了??
      

  2.   

    保留重复记录中的第一条记录,操作方法如下
    假设有重复的字段为Name,Address,要求得到这两个字段唯一的结果集
    select identity(int,1,1) as autoID, * into #Tmp from tableName
    select min(autoID) as autoID into #Tmp2 from #Tmp group by Name,autoID
    select * from #Tmp where autoID in(select autoID from #tmp2)