Jump to content

Oracle To SQL Server Help


ranjith23

Recommended Posts

Can you help me converting below SQL from Oracle to SQL Server?

SELECT DISTINCT
N.TREE_NODE_NUM,
N.TREE_LEVEL_NUM,
N.TREE_NODE,

FROM PSTREENODE N , PSTREENODE B1
WHERE N.SETID = B1.SETID
AND N.SETCNTRLVALUE = B1.SETCNTRLVALUE
AND N.TREE_NAME = B1.TREE_NAME
AND N.EFFDT = B1.EFFDT

START WITH N.TREE_NODE_NUM = (
  SELECT N1.TREE_NODE_NUM
    FROM PSTREENODE N1
   WHERE N1.SETID = N.SETID
     AND N1.SETCNTRLVALUE = N.SETCNTRLVALUE
     AND N1.TREE_NAME = B1.TREE_NAME
     AND N1.EFFDT = N.EFFDT
     AND N1.TREE_NODE = B1.TREE_NODE)
CONNECT BY PRIOR N.PARENT_NODE_NUM = N.TREE_NODE_NUM

ORDER BY N.TREE_NODE_NUM

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...