XML Datatype Method – Value()
This performs an XQuery against the XML and returns a value of SQL type. This method returns a scalar value.
The syntax is
value (XQuery, SQLType)
The below shows how to return the company name value of a varchar datatype
SELECT JobHistory.value('(/Job/CompanyName)[1]','varchar(100)') FROM Employee
The syntax is
value (XQuery, SQLType)
The below shows how to return the company name value of a varchar datatype
SELECT JobHistory.value('(/Job/CompanyName)[1]','varchar(100)') FROM Employee
Comments