How do you set-up a Precedence Constraint between 2 tasks in a SSIS package

tcmmaxt
tcmmaxt used Ask the Experts™
on
Expert:
How do you set-up a Precedence Constraint between 2 tasks, 1st task is a "Execute SQL task" and the  2nd task is a "Send Mail task"  in a SSIS 2005 package. The Send Mail task should not work or become activated and workflow should not proceed until a variable called "SubmitEmail" in the Execute SQL task (or sql query script) is set SubmitEmail=1. Please show me the details how to set this up!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Analyst
Commented:
Link the two tasks and edit Precedence by double click; You should have your variable declared and filled in precedent step then all you need is like in the picture before your email task in the SSIS.

 precedence task constraint editor

Author

Commented:
expert sage thanks:
However not sure what I have to do relative to:
"You should have your variable declared and filled in precedent step..."
My 1st task Execute SQL task which runs a  SQL script that currently sets database field SubmitEmail UPDATE TableA
SET SubmitEmail = 1
WHERE ....etc...
but when i click the Test button on the above panel I get error "varible SubmitEmail not found"?
SubmitEmail is a field in my database. Do i have to create and declare and set a new seperate field say called SubmitEmail2 and add it somewhere in the task #1 properties? not sure what to do here?
help

lcohanDatabase Analyst

Commented:
Ok so you have a SQL task1 in your package right? In that SQL task you must declare the variable to be used by the send_email_task2 and fill it in with 1 if you want the mail to be sent by the second task.
Kalyanum Deepak KumarSenior Technical Lead
Commented:
Hi tcmmaxt,

When you have the update for the SubmitEmail in execute sql task, after the update , it has to be selected again like

SELECT UpdateEmail FROM TableA.

then in the result set , the variable @SubmitEmail has to be assgined to index 0. Please vote if it helped you.

Author

Commented:
thanks all and yes the above select clause was missing and helped to turn the Precedence Contstraint arrow green which is located between task#1"Execute SQL task" and 2nd task "Send Mail task". However the Send Mail task does not fire or execute athough it will send email out when I select it and manually execute it. It does not fire after the Precedence Contstraint  is satisfied and no errors appear in the output window. Have to figure out what's missing and preventing Send Mail task to automatically execute? Will vote if no one can resolve this? again, thanks all

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial