Hi there
can someone help me with a problem - it should be fairly straightforward but I'm a bit new to xml and can't quite find any examples of what I'm trying to do.
in short, I have some xml stored in a database (sql server 2000) and I want to select a field value.
here is some sample code of what I'm trying to do:
I've pieced this together but I can't just select the name from the record. I'm sure it's straight forward. Any tips on how do I do this correctly?
Thanks in advance!
can someone help me with a problem - it should be fairly straightforward but I'm a bit new to xml and can't quite find any examples of what I'm trying to do.
in short, I have some xml stored in a database (sql server 2000) and I want to select a field value.
here is some sample code of what I'm trying to do:
Code:
declare @idoc int
exec sp_xml_preparedocument @idoc output, '<items><item><name>geoff</name><id>5</id></item></items>'
select name from openxml (@idoc, '/items/item',2)
--with (name varchar(50))
exec sp_xml_removedocument @idoc
I've pieced this together but I can't just select the name from the record. I'm sure it's straight forward. Any tips on how do I do this correctly?
Thanks in advance!