Quantcast
Channel: SQL Server 2008 R2: Prepare a recursive query - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by Sateesh Pagolu for SQL Server 2008 R2: Prepare a recursive query

;WITH CTE AS ( SELECT COLA,COLB,','+CAST(COLA AS VARCHAR(MAX))+',' AS CHCK FROM TEST WHERE COLA=1 UNION ALL SELECT C1.COLA,C1.COLB,C.CHCK+CAST(C1.cola AS VARCHAR(MAX))+',' FROM CTE C INNER JOIN TEST...

View Article



Image may be NSFW.
Clik here to view.

SQL Server 2008 R2: Prepare a recursive query

I have the table with the two columns namely cola and colb as shown below:Table : Testcreate table Test( cola int, colb int);Records I have entered are:Cola Colb------------1 21 31 42 52 62 33 23 43 73...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images