Hello out there!
I'm trying to retrieve a number of rows from a table in SQL Server 2005. One of the columns is an XML datatype (xmlcolumn).
The XML in the column has a number of repeating nodes (Person) and I would like to retrieve some of those nodes using some kind of SQL select statement.
I have tried a number of different ways for example:
SELECT * FROM table_logg
WHERE xmlcolumn.value('(Root/Person/Data/Firstname) [1]', 'nvarchar(1000)') = 'john'
AND xmlcolumn.value('(Root/Person/Data/City) [1]', 'nvarchar(1000)') = 'boston'
This piece of code works OK BUT it only gives one occurence! How should I do in order to retrieve multiple rows?
Thanks!
I'm trying to retrieve a number of rows from a table in SQL Server 2005. One of the columns is an XML datatype (xmlcolumn).
The XML in the column has a number of repeating nodes (Person) and I would like to retrieve some of those nodes using some kind of SQL select statement.
I have tried a number of different ways for example:
SELECT * FROM table_logg
WHERE xmlcolumn.value('(Root/Person/Data/Firstname) [1]', 'nvarchar(1000)') = 'john'
AND xmlcolumn.value('(Root/Person/Data/City) [1]', 'nvarchar(1000)') = 'boston'
This piece of code works OK BUT it only gives one occurence! How should I do in order to retrieve multiple rows?
Thanks!