Jaa


How to Delete Multiple SKUs

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

The Inventory System lets you delete multiple SKUs in a single operation. To do this use one of the DeleteSkus methods. You can delete all SKUs in the catalog or you can delete the SKUs that match an SQL Server expression.

To delete all SKUs in an inventory catalog

To delete selected SKUs in an inventory catalog

Example

This example describes how to delete multiple SKUs. It first deletes all SKUs with fewer than two units on hand. It then deletes all SKUs in the catalog.

public static void DeleteInventorySkus(InventoryContext context, string catalogName)
{
    // Get the inventory catalog.
    InventoryCatalog inventoryCatalog = context.GetInventoryCatalog(catalogName);
    
    // Delete all SKUs with OnHandQuantity less than two.
    inventoryCatalog.DeleteSkus(String.Format("{0} < 2", InventorySkusDataSetSchema.OnHandQuantity));
    
    // Delete all SKUs in the catalog.
    inventoryCatalog.DeleteSkus();
 }

See Also

Other Resources

How to Manage Bulk Updates and Deletions