Skip to content
Advertisement

Use a common field in two tables with XML in SQL Server

How delete the redundance in the table #XMLItm?

My code:

In this code I want load information in two tables for a common field ID_LIST. How load the ID_LIST from #XMLLst in the temp table #XMLItm?

I want delete the field ID_LIST from XML in the table #XMLItm and take a ID_LIST from temp table #XMLLst;

Function:

In the table #XMLLst load a list whit your id (auto increment), name and remarks and export from XML to SQL.

In the table #XMLItm load a item linked with a id list.

OUTPUT EXPECTED

Advertisement

Answer

Please try the following solution. It joins list with child item fragments in the XML. Additionally, it generates two running sequences on both levels.

SQL

Output

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement