Sunday, February 19, 2012

Dynamic statement in variable - parseerror

I am trying to use this statement in a variable, including another variable:

"SELECT * FROM my_table WHERE CAST([timestamp] AS INT) > " + @.[User::LastTimestamp]

But the variable value insists on giving me this error:

The expression for variable "VariableName" failed evaluation. There was an error in the expression.

I cast the columntype "timestamp" to int, and the variable "LastTimestamp is stored as int32, and has a default value of 0. I simply can't grasp what it is I am missing.

Is it because the expression is part string and part integer? If so, how is that avoided?

Thanks in advance

Ohh, also, I have tried with (DT_STR) @.[User::LastTimestamp], but that doesnt work either|||

Casting to a string should fix the problem.

This works for me-

"SELECT * FROM my_table WHERE CAST([timestamp] AS INT) > " + (DT_WSTR,10)@.[User::LastTimestamp]

No comments:

Post a Comment