August 19, 2016 at 11:59 pm
declare @filexml xml='<IndividualSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey"> <TotalPurchaseYTD>4431.4</TotalPurchaseYTD> <DateFirstPurchase>2003-04-10Z</DateFirstPurchase> <BirthDate>1956-01-23Z</BirthDate> <MaritalStatus>S</MaritalStatus> <YearlyIncome>50001-75000</YearlyIncome> <Gender>F</Gender> <TotalChildren>2</TotalChildren> <NumberChildrenAtHome>0</NumberChildrenAtHome> <Education>High School</Education> <Occupation>Skilled Manual</Occupation> <HomeOwnerFlag>1</HomeOwnerFlag> <NumberCarsOwned>2</NumberCarsOwned> <CommuteDistance>5-10 Miles</CommuteDistance> </IndividualSurvey>'
select doc.col.value('xmlns[1]','varchar(3000)') totalpurchaseid, doc.col.value('DateFirstPurchase[1]','varchar(30)') totalpurchaseid, doc.col.value('BirthDate[1]','varchar(30)') totalpurchaseid, doc.col.value('MaritalStatus[1]','varchar(30)') totalpurchaseid, doc.col.value('YearlyIncome[1]','varchar(30)') totalpurchaseid, doc.col.value('Gender[1]','varchar(30)') totalpurchaseid from @filexml.nodes('/IndividualSurvey') doc(col)
August 20, 2016 at 4:18 am
And your question is?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply