This is the function that I am trying to create
CREATE FUNCTION fnGetValue
(
@WhereClause VARCHAR(256)
)
RETURNS TABLE
AS
RETURN
SELECT A.Name, B.Value
FROM A
INNER JOIN B ON A.Akey = B.AKey
WHERE + @WhereClause +
GO
The parameter @WhereClause
is built from my PHP, something like
A.Akey IN (2,3)
But when I try this I get this error
An expression of non-boolean type specified in a context where a condition is expected, near 'AND'.
I want to let everyone know, I know query is wrong because SQL is expecting an expression that can be evaluated to boolean. But my question is how to achieve the thing I am trying for. Please help me.