用於數據擦除的相關方法
CREATE TABLE #match_cols
(
row_num int,
col2 char(1),
col3 char(1)
)
GO
CREATE UNIQUE INDEX #match_col2_idx
ON #match_cols(col2,col3)
WITH IGNORE_DUP_KEY
GO
--先檢查一下match_cols有很多重復的行
SELECT "COUNT(*)"=COUNT(*),col2,col3
FROM match_cols
GROUP BY col2,col3
INSERT #match_cols
SELECT * FROM match_cols
--#match_cols沒有重復的行
SELECT "COUNT(*)"=COUNT(*),col2,col3
FROM #match_cols
GROUP BY col2,col3