Syntax for xquery with namespace in the node
问题 We are trying to get IdValue from sql query. We are using sql server 2005. DECLARE @MyXML XML SET @MyXML = '<Candidate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ns.hr-xml.org/2007-04-15"> <CandidateProfile> <ProfileId> <IdValue>9499063</IdValue> </ProfileId> </CandidateProfile> </Candidate>' SELECT @MyXML.value('Candidate[1]/CandidateProfile[1]/ProfileId[1]','varchar(10)') AS Id This is not working because of the name