I have a SP as below (example only) and want to filter the City based on values passed in as a parameter.
SELECT * FROM Customers
WHERE City IN (@cities_as_a_parameter);
In my C# code, I have the below
cmd.Connection = con;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "MY_SPNAME";
cmd.Parameters.AddWithValue("@cities_as_a_parameter", "'Paris','London', 'xxx', 'yyyy'");
My question is how to pass multiple values to the SP parameter @cities_as_a_parameter ? Above code does not work and want to know what is the correct way of doing this.
What is the best way to do this ?
OR is there any other way to do this (without using multiple where conditions)?