Montadar
do you have any idea how to change the declaration of (@segment varchar(50) = null ) to accept single or multiple values that are passing from
code behind.
See one of my earlier replies (copied below)
A select query that return records for a comma separated list of specified employee namesDECLARE @names NVARCHAR(MAX)= N'roma,davinia,vivian';select*from tblEmployees where name in(select item from dbo.SplitStrings_CTE(@names, N','))An insert query to insert new employees (name only) from a comma separated list specified employees
DECLARE @names NVARCHAR(MAX)set@names= N'eulender,pontsho,tumelo,piotr' insert into tblEmployees (name)select item from dbo.SplitStrings_CTE(@names, N',')Note: do not use spaces because the will be added to the name (segment in your case)