I have \'param1, param2, parma3\'
coming from SSRS to a stored procedure as a varchar
parameter: I need to use it in a query\'s IN
cla
If you are using SQL 2016 and above string_split
you can use.
-- @param is where you keep your comma separated values example:
declare @param = 'param1,param2,param3'
select * from table1 where col1 in (select TRIM(value) from string_split(@param,',')
More information about string_split check offical documemt
Furthermore, TRIM()
is used to trim values from white spaces.