0

Based on few conditions I want to set a variable to true or false in Execute SQL Task. This is my query

If  ?  <> 0
    BEGIN
    If CAST( ?  as DATE) <> (select MAX(cast(Date as DATE)) from <Table>)
        begin 
        set ? OUTPUT = 'True'
        end
END

I have created 3 parameter mapping. Removing the condition set ? OUTPUT = 'True' is fine. But when I add this statement I am getting error.

I am sure this would be syntax error but I am unable to figure it out. I tried all these

set ? OUTPUT = 'True'
set ? = 'True'
    ? = 'True'

But nothing works and I end up with error. Please help.

4

1 回答 1

0

我认为您应该选择它,但我不会使用输出作为名称。

If  ?  <> 0
    BEGIN
    If CAST( ?  as DATE) <> (select MAX(cast(Date as DATE)) from <Table>)
        begin 
        select 'True' as Result
        end
END

将执行 sql 语句的结果映射到目标变量。

于 2015-10-13T12:59:14.433 回答