Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Hi I get problem retrieve XML data from SQL2000 server.

The table structure is as following:

ID   Name   XML
1    Name1  <Root><DATA1>1-Data1</DATA2><DATA1>1-Data2</DATA2></Root>
2    Name2  <Root><DATA1>2-Data1</DATA2><DATA1>2-Data2</DATA2></Root>
3    Name3  <Root><DATA1>3-Data1</DATA2><DATA1>3-Data2</DATA2></Root>

How can I get the result out like this:

ID   Name   Data1   Data2
1    Name1  1-Data1 1-Data2
2    Name2  2-Data1 2-Data2
3    Name3  3-Data1 3-Data2

I am new SQL2000. Is such query possible in SQL2000?

Thanks for your help in advance!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

In SQL Server 2005 and up, this would be no problem at all - if your XML very even valid, that is:

<Root> 
    <DATA1>1-Data1</DATA2>
    <DATA1>1-Data2</DATA2>
</Root>

You can't have an opening tag of <DATA1> and then a closing tag of </DATA2> - this is not well-formed XML and no XML parsing engine will be able to handle it....

But SQL Server 2000 doesn't really support XML processing (it can import XML and spit out XML, but it can't really process it) - I'm afraid you're out of luck with the 2000 version.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.