hi yosiasz, this is a life scenario and i am using small scale of product inventory for better understanding. The colors represent the product's color.
The 2 products just a small scale that I am using for better understanding querying sql query to xml. The format I am working on is to achieve like this example. So, instead using large product records set, I created just very basic for an example.
create table #products(Product_A int, Product_B int, Model int )
insert into #products
select 1025, 1123, null
SELECT Product_A ,
Product_B,
Model
FROM #products
--FOR XML PATH ('Products_Inventory')
--FOR XML AUTO, ELEMENTS XSINIL;
FOR XML PATH ('Products_Inventory'), ELEMENTS XSINIL;
--FOR XML PATH ('Products_Inventory'), ELEMENTS ;
drop table #products
<Products_Inventory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Product_A>1025</Product_A>
<Product_B>1123</Product_B>
<Model xsi:nil="true" />
</Products_Inventory>