recursive cte

Get hierarchical data in order

In this post, we are going to learn how we can get hierarchical data in order. We are dealing with a user defined hierarchical data which can have “n” number of siblings and their siblings can also have “n” number of siblings in turn. For demo purpose, we have a Product_Master table, in which a product can be marked as a parent […]

Get hierarchical data in order Read More »

Convert a comma separated list into table

In this post, we are going to learn “how we can convert a comma separated list into a table using a recursive CTE”. Below is the code: Why OPTION MAXRECURSION? Hint OPTION(MAXRECURSION 32767) is a query hint which instructs to compiler to iterate 32767 times. Default, max recursion of a loop in SQL is 100 and in case we

Convert a comma separated list into table Read More »