SQLUSA

Microsoft SQL Server 2005 Best Practices

How to use the XML value method?

 

Execute the following script in Query Editor to list all the banks used by bike stores:


USE AdventureWorks

SELECT distinct Demographics.value('declare namespace
AWMI="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey";
(AWMI:StoreSurvey/AWMI:BankName)[1]','varchar(30)')
as [Store Banks]
FROM Sales.Store

 

SQLUSA - The Best SQL Server 2005 Training in the World
 
 
SQLUSA.com Home Page