Wednesday, March 21, 2012

Migrate Oracle "Connect By" clause to TSQL

Hi,

Since this is my first post, if there are any violations in the rules of the forum, please let me know so that I can correct myself from next time.

I am currently working on migrating some oracle stored procedures to TSQL. One of the stored procedures uses "Connect By" clause in a select query, provided by Oracle. Is there a standard way to migrate this clause when we migrate this to SQL Server TSQL Stored Procedure.

For example:

I have a query in the oracle stored proc like:

SELECT id FROM t1 START WITH t1.id = p_id CONNECT BY
PRIOR t1.id = t1.parent_p_id

where p_id is an IN parameter passed to the stored procedure.

Please note that I have assumed "Connect By" clause syntax and usage is known to anyone who replies for this post.

Thanks for your help.

--
SriUnfortunately, there is no off-the-shelve recursive command available in TSQL, but it will be in the next (Yukon) release.|||No kidding?

[marching band playing]
THANK GOD
[/marching band playing]

No comments:

Post a Comment