|
I have a table (Table1) which has a coloumn by name XMLColoumn a part of the xml is like My table is (Table1)
I am trying to get output as I am trying to do something like Which returns me only the first row ie maths..how can i get all the Please let me know i tried a lot to find...but couldnt.Please help!
(comments are locked)
|
|
You need to use CROSS APPLY to expand the nodes of the XML column. i.e. Moreover, I do not know your environment but having student subjects in xml format seems to be a very bad option as it makes a bad schema design. @palum And just in case if you have some records in your table which don't have value in the column storing the subjects in xml format but still need to include these records in your results then you can use the outer apply in place of cross apply, i.e. SELECT
[StudentNo],
x.i.value('text()[1]', 'nvarchar(max)') Subjects
FROM @Student AS S
outer apply StudentSubjects.nodes('/StudentSubjects/ValueName') x(i)
Apr 26 '12 at 05:55 PM
Oleg
(comments are locked)
|

