December 2001
Intermediate to advanced
800 pages
17h 55m
English
As the examples in the previous chapter demonstrated, you can retrieve XML data from SQL Server using the FOR XML option of the SELECT command. FOR XML causes SELECT to return query results as an XML stream rather than a traditional rowset. This stream can have one of three formats: RAW, AUTO, or EXPLICIT. The basic FOR XML syntax looks like this:
SELECT column list FROM table list WHERE filter criteria FOR XML RAW | AUTO | EXPLICIT [, XMLDATA] [, ELEMENTS] [, BINARY BASE64]
Although I'll discuss these options separately, let's go over them briefly now.
RAW returns column values as attributes and wraps each row in a generic row element. AUTO returns column values as attributes and wraps each row in an element named after the ...
Read now
Unlock full access