Why the in operator is not appearing?

I have a query like this:


SELECT {Product}.* from {Product} where @WhereClause 

The WhereClause is a parameter like this:

If(PDs = "",     "1=1",     "{Product}.[COD] in (" + PDs + ")")


In the test query, if the  parameter is “1=1” the query works without errors, but if the parameter is "'AB002','AB004'" it appears an error, relational operator invalid. 

And in the executed SQL the “in” part of the query doesnt appear, the executed SQL is like: SELECT  "Product"."COD",… from  "Product"  where 'AB003', 'AB004'. 

Do you know why the “in" part of the query is not appearing?


Is "Expand Inline" set to Yes?  This may be the issue that you are having.  Just be aware when you do this of the implications of changing that setting:


It may be wise also to change the statement so that you aren't passing in the entire WHERE clause, rather just pieces of it.

Thanks but the expand in-line is set to yes.