1

Possible Duplicate:
Simulation of CONNECT BY PRIOR of ORACLE in SQL SERVER

--I need to convert the below PL/SQL to SQL

SELECT  DataMapId, REPLACE((QtyType, '#'), '#') AS QtyTypes
            FROM    (
                        SELECT  DataMapId, '<QtyType>' + cast(DataTypeId as nvarchar(200)) + '</QtyType>' AS QtyType,
                                ROW_NUMBER() OVER (PARTITION BY DataMapId ORDER BY DataTypeId) AS rn
                        FROM    tblDataMapChannels
                    )
            WHERE   CONNECT_BY_ISLEAF = 1
            CONNECT BY  rn = PRIOR rn + 1
                AND     DataMapId = PRIOR DataMapId
            START WITH  rn = 1
Community
  • 1
  • 1
user280868
  • 133
  • 8
  • 2
    That's not PL/SQL; it's already SQL (Oracle SQL, to be precise)... – Jeffrey Kemp May 07 '12 at 07:27
  • You could also try [this search](http://www.google.com/cse?cx=018205968162215846785%3A7n6ajnwyz-i&ie=UTF-8&q="connect+by"+("tsql"+|+"t-sql"+|+"transact+sql"+|+"sql+server")&sa=Search). – Andriy M May 07 '12 at 10:48

0 Answers0