xml to SQL table

Mar 19 2020 11:19 AM

Guys!

I have a below table where the Address is in xml

UserId

Name

Address

1

Johny

<UserId>1</UserId><UserName>Johny</UserName><Address><Street>Johny St</Street><City>New York</City><ZipCode>08237</ZipCode></Address>

2

Harry

<UserId>2</UserId><UserName>Harry</UserName><Address><Appartment>Brook Side</Appartment><Number>101</Number><Street>Harry St</Street><City>Virginia</City><ZipCode>04234</ZipCode></Address>

I want a NEW table like this below

Userid

Name

Appartment

Number

Street

City

ZipCode

1

Johny

  

Johny St

New York

08237

2

Harry

Brook Side

101

Harry St

Virginia

04234

Can I get it with SQL Query/SP please?


Answers (2)