Posted By

ezerick on 11/02/11


Tagged


Versions (?)

Fox XML in TSQL


 / Published in: SQL
 

  1. The following example specifies FOR XML AUTO WITH the TYPE AND XMLSCHEMA options. Because of the TYPE OPTION, the result SET IS returned TO the client AS an xml type. The XMLSCHEMA OPTION specifies that the inline XSD schema IS included IN the XML DATA returned, AND the ELEMENTS OPTION specifies that the XML result IS element-centric.
  2. SQL
  3.  
  4. USE AdventureWorks2008R2;
  5. GO
  6. SELECT p.BusinessEntityID, FirstName, LastName, PhoneNumber AS Phone
  7. FROM Person.Person AS p
  8. JOIN Person.PersonPhone AS pph ON p.BusinessEntityID = pph.BusinessEntityID
  9. WHERE LastName LIKE 'G%'
  10. ORDER BY LastName, FirstName
  11. FOR XML AUTO, TYPE, XMLSCHEMA, ELEMENTS XSINIL;

Report this snippet  

You need to login to post a comment.