In the below code i have pass multiple values with comma Separated to @i_CustomerGroupID and one value to @i_LocationID.In which i face a issue "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.".Pls help me to solve the issue.
ALTER PROCEDURE [dbo].[spInsertCustomerGroupLocationMap]
-- Add the parameters for the stored procedure here
@i_LocationID int,
@i_CustomerGroupID varchar(100)
--WITH ENCRYPTION
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
IF NOT EXISTS (SELECT 1 FROM CustomerGroupLocationMap WHERE LocationID = @i_LocationID AND CustomerGroupID = @i_CustomerGroupID)
BEGIN
INSERT INTO CustomerGroupLocationMap (LocationID, CustomerGroupID) VALUES (@i_LocationID, (SELECT * FROM dbo.CSVToTable(@i_CustomerGroupID)));
END
END