Question : Use xml parameter in SQL Server select

The below query #1 returns 'Rock' 3 times... how can I modify this to return the values from all three nodes.

Basically what I want to do is to use query # 2 to return a table with ID and SSN columns and one row per student.

Thanks.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
1~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DECLARE @x xml 
SET @x='

    Rock
    Stud
    Star
'
 
SELECT T.c.value('@id','int') as id, T.c.value('(/Root/row/me)[1]','varchar(30)') as name
FROM   @x.nodes('/Root/row') T(c)
GO
 
2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
	
		123456789
		1290936987
	
	
		987654321
		0987654321
	
	
		555555555
		7777777777
	
'

Answer : Use xml parameter in SQL Server select

please try this:
1:
2:
3:
SELECT T.c.value('@id','int') as id
, T.c.value('.','varchar(30)') as name
FROM   @x.nodes('/Root/row') T(c)
Random Solutions  
 
programming4us programming4us