Replace
Declare @CustomerIDs VARCHAR(50) = '1,2'
declare @CustomerTbl table(Stat nvarchar(300))
insert into @CustomerTbl
select DISTINCT CustomerID
from CustomerMaster
WHERE ','+ Convert(varchar(50),@CustomerIDs) +',' like '%,'+ Convert(varchar(50),CustomerID) +',%'
Select * FROM CustomerMaster INNER JOIN
@CustomerTbl ON CONVERT(VARCHAR(300),CustomerID) = @CustomerTbl.Stat
With
Declare @CustomerIDs VARCHAR(50) = '1,2'
declare @CustomerTbl table(Stat nvarchar(300))
insert into @CustomerTbl
select DISTINCT CustomerID
from CustomerMaster
WHERE ','+ Convert(varchar(50),@CustomerIDs) +',' like '%,'+ Convert(varchar(50),CustomerID) +',%'
Select * FROM CustomerMaster INNER JOIN
@CustomerTbl ct ON CONVERT(VARCHAR(300),CustomerID) = ct.Stat
No comments:
Post a Comment