Tag Archives: CTE

Example of Recursive Query using CTE – SQL Server

I would like to give a very simple example of recursion using CTE (Common Table Expression) As part of the demo, I will create a table with ID, EmployeeName, and ManagerID indicating org structure. Following CTE queries will fetch the … Continue reading

Posted in Productivity, Script, SQL, SQL Query | Tagged , , , | Leave a comment

Identify and delete duplicate records in a table – SQL

One of the best option is to use CTE, ROW_NUMBER() to identify and delete duplicate records Sample Code/Demo: Note: If one of the column is of type NText, will not be able to sort based on the column and it … Continue reading

Posted in Productivity, Script, SQL, SQL Query | Tagged , , , , , | 1 Comment