Oracle SQL supports START WITH
expression.
For instance,
CREATE VIEW customers AS
SELECT LEVEL lvl, customer_code, customer_desc, customer_category
FROM customers_master
START WITH some_column = '0'
CONNECT BY PRIOR CUSTOMER_CODE = PARENT_CUSTOMER_CODE;
If a table contains hierarchical data, then you can select rows in a hierarchical order using hierarchical query clauses.
START WITH
specifies the root row(s) of the hierarchy.
CONNECT BY
specifies the relationship between parent rows and child rows of the hierarchy.
Is there an equivalent expression for MS-SQL ?