Pass comma separated variable to IN clause in SQL Server

Last Reply 4 months ago By pandeyism

Posted 4 months ago

hi

i want to pass a list of values string like in a dinamic query

DECLARE @Lines AS NVARCHAR(MAX)

SET @Lines = 'PL1,PL2,PL3'

SET @Query = '

WHERE ProductLines IN (@Lines) ...'

How can do that?

This question does not have replies that have been liked.