Hi Ramachandran,
You can just send the @Combo value parameter as "1,2,hj,lo,2".
and in sql stored procedure split these values with "," (Comma) and create a table with these values. after that you can write your query like
select Sizes,SUM(Quantity) from tbl_SizeBreakup where (Brand=@brand) and (Combo in (select value from @Values)) ...
here is a sample code what you have to do in stored procedure(suppose you have pass
new SqlParameter("@Combo","1,2,lo,54"))
declare @Values Table
(
RowId int Not Null Identity(1,1) Primary Key
,Value nvarchar(255) Not Null
)
set @Delimiter=','
Declare @startPos smallint
,@endPos smallint
If (Right(@Combo, 1) != @Delimiter)
Set @Combo = @Combo + @Delimiter
Set @startPos = 1
Set @endPos = CharIndex(@Delimiter, @Combo)
While @endPos > 0
Begin
Insert @Values(Value)
Select LTrim(RTrim(SubString(@Combo, @startPos, @endPos - @startPos)))
Set @Combo = Stuff(@Combo, @endPos, 1, '')
Set @startPos = @endPos
Set @endPos = CharIndex(@Delimiter, @Combo)
end
select Sizes,SUM(Quantity) from tbl_SizeBreakup where (Brand=@brand) and (Combo in (select Value from @Values))
I think you will get what you needed..