Wednesday 9 October 2013

08. The management of AdventureWorks requires a list containing the skills of all the candidates who have applied for a vacancy. The details of all the candidates are stored in the XML format in the HumanResources.JobCandidate table. How will you display the list?

select jobCandidateID,Resume.value('declare namesPace
ns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume";
(/ns:Resume/ns:name/ns:name.First)[1]','nverchar(20)')
as [first name], Resume.value('declare namespace
ns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-work/Resume";
(/ns:Resume/ns:name/ns:name.Last)[1]','nvarchar(20)')
as [Last name],Resume.value('declare namespace
ns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-work/Resume";
(/ns:Resume/ns:Skills[1]','nvarchar(max)')
as [Skills]from HumanResources.JobCandidate

No comments:

Post a Comment