use result of sql query for conditional statement

  • I'm trying to take the result from this query and assign it a variable to use in a Precedence Constraint Editor of the task (DateOnly is a custom function):

    SELECTCAST(COUNT(A.LASTPRCDT) As nvarchar(1)) As HistAvail

    FROM DB2_ODBC.JHASVR.DATSRM.PRCDATE A

    WHERE A.LASTPRCDT = dbo.DateOnly(getdate())

    So if the return is

    HistAvail

    0

    Then I'll have the package exit otherwise I want it to process the package.

    I've read this article but to no avail....

    http://www.mssqltips.com/tip.asp?tip=1487

    Thanks in advance.

  • I'd just expand the package a little, using a conditional split. Assuming your condition is true then exit, otherwise go down the brank that has all of the preexisting logic.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • If you are storing the results of this query in a Int32 varible Var1 for e.g. then in the Presedence Constriant Editor you can choose Expression and use something like

    @[User::Var1]==0?False:True

    HTH

    ~Mukti

  • Solid. Thanks Mukti!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply