Hi All, we are back after a pause.Here's an interesting article which talks about the different ways of selecting the duplicate rows from a table.Hope it will be useful to you.
Article
Showing posts with label CTE. Show all posts
Showing posts with label CTE. Show all posts
An interesting article - Selecting Duplicate Rows in a table
Sunday, 18 October 2009
Labels:
Article,
CTE,
Duplicates,
ROW_NUMBER()
Top 10 SQL server Performance tuning tips - 6
Tuesday, 8 September 2009
Set Based Approach
Even though procedural approach is easier for most of the programmers,it (Use of Cursor, or, UDF to process rows in a result set) should be avoided when working with large result set.Most of the times cursors can be replaced by CTE(Common Table Expression). Avoiding Cursors with SQL Server 2005
Labels:
CTE,
Cursors,
Performance,
Tips
Removing Duplicates using CTE
Monday, 31 August 2009
Here's a code snippet which removes the duplicate records,using CTE
WITH CTE ([col1], cnt)
AS
(
SELECT [col1],
ROW_NUMBER() OVER(PARTITION BY [col1] ORDER BY [col1]) AS cnt
FROM table1
)
DELETE
FROM CTE
WHERE cnt > 1
Labels:
CTE,
useful scripts
Subscribe to:
Posts (Atom)