Thanks Lukezy
I modified the sp DSC_Category_Get to join with the view and it works fine.
Thanks
BEGIN
IF (@CategoryId = 0)
BEGIN
INSERT INTO #subset_Category
SELECT c.categoryId
FROM DSC_Category c INNER JOIN vw_DSC_Category_Count v
ON c.categoryId = v.categoryId
WHERE c.parentId IS NULL AND v.count > 0
END
ELSE
BEGIN
INSERT INTO #subset_Category
SELECT @CategoryId
END
END
ELSE
BEGIN
INSERT INTO #subset_Category
SELECT c.categoryId
FROM DSC_Category c
JOIN #CategoryUpLevel parent
ON parent.categoryId = c.parentId INNER JOIN vw_DSC_Category_Count v
ON c.categoryId = v.categoryId WHERE v.count > 0
END
|