|
Posted by Erland Sommarskog on 12/26/07 23:11
Theo Müller (bochumer.szene@googlemail.com) writes:
> I am absolute a novice in XML but need to shred XML into SQL Server
> 2005.
> I studied some examples, but only with simple XML Docs.
> My docs seems to be looking more complex.
>
> Maybe someone can point me into the right direction:
Since I don't know what you what you want to get out of the document,
I can't give you any code.
In general, there are two methods: OPENXML and XQuery. OPENXML is
the older method, introduced in SQL 2000, XQuery was added in SQL 2005.
XQuery is a standardised language to query XML documents, not only
in SQL Server.
OPENXML may be easier to get started with, but I since XQuery is newer,
I think it's better in the long run. Then again, I have seen situations
where the performance XQuery have been outright poor with element-
centred XML which is what you have.
Both OPENXML and XQuery are described in Books Online, and you could
start reading, but of course if you are completely new to XML, the
learning curve may be a bit steep.
Unfortunately, I cannot really give good recommendations on books. I
learnt XML myself from "XML Step by Step" by Michael Yuong and
"Programming Microsoft SQL Server 2000 with XML" by Graeme Malcolm.
The latter book is definitely dated by now, unless the author has an
update for SQL 2005. The former book is a little more timeless, and
is good enough to learn you what XML is, but it will not teach you
XQuery. Unless, again, there is a newer edition; my copy is several
years old.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|