I am trying to use Ado.Net Sql command to select data from a table with a date filter.
SELECT COLUMN1
, COLUMN2
FROM TABLENAME
WHERE DATE_INSERTED > @[User::LastInsertDate]
Both Date_Inserted
and @[User::LastInsertedDate]
are of type DateTime
. When I try to evaluate expression in the expression builder l get the following error;
The expression might contain an invalid token, an incomplete token, or an invalid elemnt, it might not be well-formed, or might be missing part of a required element such as a parenthesis.
Problem diagnosis from original revision of accepted answer:
Here is my understanding of your question. I believe that you created two variables under package scope. A variable named
LastInsertDate
of DateTime data type and another variable namedSqlQuery
of String data type to store the SQL SELECT command.You set the EvaluateAsExpression property on variable
SqlQuery
toTrue
. You then entered the following commandSELECT COLUMN1, COLUMN2 FROM TABLENAME WHERE DATE_INSERTED > @[User::LastInsertDate]
When you clicked EvaluateAsExpression, you got the following error message:
Expression cannot be evaluated. Additional information: Attempt to parse the expression "SELECT COLUMN1, COLUMN2 FROM TABLENAME WHERE DATE_INSERTED > @[User:LastInsertDate]" failed. The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis.