Append this block of code to your stored procedure so that it will solves your problem
CREATE Table #TempTable
(
Val Varchar(max)
)
DECLARE @LenString int
WHILE len( @VarPrdVendorType ) > 0
BEGIN
SELECT @LenString =
(CASE charindex( ',', @v )
WHEN 0 THEN len( @v )
ELSE ( charindex( ',', @v ) -1 )
END
)
INSERT INTO #Temptable
SELECT substring( @VarPrdVendorType, 1, @LenString )
SELECT @VarPrdVendorType =
(CASE ( len( @v ) - @LenString )
WHEN 0 THEN ''
ELSE right( @VarPrdVendorType, len( @v ) - @LenString - 1 )
END
)
END
and Code block as
Quote:
AND PrdVarVendorType IN(@VarPrdVendorType)
AND PrdVarVendorType IN (Select Val From #Temptable)
you can use above code in user defined function so that you can use every where and code looks like
AND PrdVarVendorType IN (Select * FROM UserDefinedFunction)