We are creating an interface with multiple checkboxes for categories (Category designation samples: L1,L2,C1,etc). We will use this interface in multiple environments, each with unique category designations. I want to create a stored procedure I can use in all environments that will accept a list of the checked category designations, seperated perhaps with a semi-colon, in one character string ('L1;C2;P3'), parse out the category designations and then only include results for those categories. What is the best way to do this?
CREATE PROCEDURE [GetItems]
@cCategoryCodes char(100) -- Codes will be seperated by a semi-colon
ItemCode = (SELECT ItemCategories.Code FROM ItemCategories WHERE ItemCategories.keyItemCategories = Items.keyItemCategories)
WHERE ItemCode IN @cCategoryCodes