try below
CREATE Procedure [reports].[report_Top20Values]
(
@CalendarYearMonth INT,
@AssetSubGroup VARCHAR(600)
)
AS
BEGIN
;WITH CTE1 AS
(SELECT distinct Val from dbo.fn_String_To_Table(@AssetSubGroup,',',1))
select CalendarYearMonth,SomeValue
from table1 g inner join CTE1 b on g.AssetSubGroupID = b.val
where CalendarYearMonth = @CalendarYearMonth
END
Please give us the execution plan
No comments:
Post a Comment