Hi all,
I am learning XPATH and XQUERY from the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles, (published by apress). I copied the Code Listing 12-8 FOR XML PATH Using XPath Node Tests (listed below) and executed it in my SQL Server 2012 Management Studio:
--Coles12_8.sql // saved in C:/Documemnts/SQL Server Management Studio -- Coles Listing 12-8 FOR XML PATH Using XPATH Node Tests -- Retrieving Name and E-mail Addresses with FOR XML PATH in AdvantureWorks -- 16 March 2015 0935 AM USE AdventureWorks; GO SELECT p.NameStyle AS "processing-instruction(nameStyle)", p.BusinessEntityID AS "Person/@ID", p.ModifiedDate AS "comment()", pp.PhoneNumber AS "test()", FirstName AS "Person/Name/First", MiddleName AS "Person/Name/Middle", LastName AS "Person/Name/Last", EmailAddress AS "Person/E ...

Go to the complete details ...