This value is in a column in a table:
'962091','962092','962093'
I try to use this in a where
. First I declare a variable:
DECLARE @KPLnr varchar(100)
SET @KPLnr = CONVERT(nvarchar(max), dbo.UF_GetOption('FastecKPL')) /* here I get the values in */
If I select, I get the correct values of @KPLnr: '962091', '962092','962093'
, but if I try to use it in a where statement, it seems like the value is set wrong.
I get 0 results, but if I set it manually with:
WHERE c.kpl IN ('962091', '962092','962093')
I got 414 results.
So why is WHERE c.kpl IN ('962091', '962092', '962093')
not equal to
WHERE c.kpl IN (@KPLnr)
in my code?