XML Datatype Method – Query()

The Query() method is used to query the XML data using XQuery Expression

The Syntax is

query ('XQuery')

The below shows how to display the xml node where jobid is 1

SELECT JobHistory.query('/Job[@JobID=1]') FROM Employee

The below shows how to display the company name node where jobid is 1

SELECT JobHistory.query('/Job[@JobID=1]/CompanyName/text()') FROM Employee

Comments

Popular posts from this blog

Jesus - God Thinks of you.

ASP.NET 4.0 Feature - URL Routing

Tips on JQuery Intellisense in VS 2008