Archive for September 2008

Many times, developer’s wants to set some quantity in their inventory in order to test inventory functionality in starter site. I created a script which will help developers to populate inventory. Kindly follow the steps below

  1. Make sure you set Inventory Catalog and product catalog details
  2. There are two sql queries mentioned below one for deleting existing inventory and another for inserting new inventory for all products
  3. So first execute delete query and then insert query

Delete from  [StarterSite_productcatalog].[dbo].[Default_InventorySkus]
GO

DECLARE @InventoryCatalogName VARCHAR(50)
DECLARE @ProductCatalogName VARCHAR(50)
SET @InventoryCatalogName  = ‘Default’
SET @ProductCatalogName = ‘Adventure Works Catalog’
INSERT INTO [StarterSite_productcatalog].[dbo].[Default_InventorySkus]
           ([SkuOid]
           ,[InventoryCatalogName]
           ,[ProductCatalogName]
           ,[SkuId]
           ,[SkuVariantId]
           ,[Backorderable]
           ,[Preorderable]
           ,[Status]
           ,[OnHandQuantity]
           ,[StockOutThreshold])
     SELECT newid(), 
                                @InventoryCatalogName,
                                @ProductCatalogName,
                                productid,
                                variantid,
                                0,
                                0,
                                1,
                                999,
                                1
                                from [Adventure Works Catalog_CatalogProducts]
                                Where (productid !=” and variantid !=”) or (productid !=” and variantid =”)

Related Articles


If you like this post, please click on our sponsor advertisement.


Follow me on Google+
Add to circles

In 0 people's circles

Sign up for Newsletter