The following should get all of the info for three product attributes, ( I only use two now)
All I need to do now is write the formulas in Excel to create the SQL scripts for each product, product attribute and product attribute combination update. Maybe this will help others.
SELECT p.[Id]
,coalesce(pvac.sku,p.[SKU]) as SKU
,p.[Name]
,p.[Price]
,pvacid as ProdAttCombinationId
,coalesce(pvac.att1Id,999999) as AttributeId1
,coalesce(pvac.att1Name,'No Variant1') as AttributeName1
,coalesce(pvac.Att1Adjustment,0) as PriceAdjustment1
,coalesce(pvac.att2Id,999999) as AttributeId2
,coalesce(pvac.att2Name,'No Variant2') as AttributeName2
,coalesce(pvac.Att2Adjustment,0) as PriceAdjustment2
,coalesce(pvac.att3Id,999999) as AttributeId3
,coalesce(pvac.att3Name,'No Variant3') as AttributeName3
,coalesce(pvac.Att3Adjustment,0) as PriceAdjustment3
,[Published]
,[Deleted]
,[IsShipEnabled]
,[IsFreeShipping]
,[AdditionalShippingCharge]
,[DisableBuyButton]
,[CallForPrice]
,coalesce(pvac.[StockQuantity],p.[StockQuantity]) as StockQuantity
FROM [dbo].[Product] p
left join (select y.[ProductId]
,y.pvacid
,y.sku
,y.[StockQuantity]
,pvav1.id as att1Id
,pvav1.Name as att1Name
,pvav1.PriceAdjustment as Att1Adjustment
,pvav2.id as att2Id
,pvav2.Name as att2Name
,pvav2.PriceAdjustment as Att2Adjustment
,pvav3.id as att3Id
,pvav3.Name as att3Name
,pvav3.PriceAdjustment as Att3Adjustment
from (Select x.pvacid
,xml
,xml.value('(/Attributes/ProductVariantAttribute/@ID)[1]','int') as ProductVariantAttributeID1
,xml.value('(/Attributes/ProductVariantAttribute/ProductVariantAttributeValue/Value)[1]','int') as ProductVariantAttributeValue1
,xml.value('(/Attributes/ProductVariantAttribute/@ID)[2]','int') as ProductVariantAttributeID2
,xml.value('(/Attributes/ProductVariantAttribute/ProductVariantAttributeValue/Value)[2]','int') as ProductVariantAttributeValue2
,xml.value('(/Attributes/ProductVariantAttribute/@ID)[3]','int') as ProductVariantAttributeID3
,xml.value('(/Attributes/ProductVariantAttribute/ProductVariantAttributeValue/Value)[3]','int') as ProductVariantAttributeValue3
,x.sku
,x.[StockQuantity]
,x.[ProductId]
FROM (SELECT convert(xml , attributesxml ) as xml
,pvac.sku
,pvac.[StockQuantity]
,pvac.id as pvacid
,pvac.[ProductId]
FROM [activele_leisure_nop].[dbo].[ProductVariantAttributeCombination] pvac ) as x) as y
left join [dbo].[ProductVariantAttributeValue] as pvav1
on( y.ProductVariantAttributeValue1 = pvav1.Id)
left join [dbo].[ProductVariantAttributeValue] as pvav2
on( y.ProductVariantAttributeValue2 = pvav2.Id)
left join [dbo].[ProductVariantAttributeValue] as pvav3
on( y.ProductVariantAttributeValue3 = pvav3.Id)
) as pvac
on (pvac.productid = p.id)
cheers,
Anthony