 Hello, welcome to SSUnitech, so till this side and this is continuation of SSIS tutorial. So today we gonna discuss about precedence constant and this is very important. So let's start. So precedence constants are used to link the executable tasks and containers and this is part of control flow. The execution of next executable depends upon the status of previous executables. So it has three values, first is success, then failure and then completion. So as we can see in this example, we have a execute equal task. If our execute equal task will be executed successfully, then our success and completion dataflow task will be executed. If our execute equal task will be completed with failure, then our failure and completion will be executed. So as we can say that our completion will be executed doesn't matter our previous executable which is our execute equal task is executed successfully or failure. And success and failure will be depend upon the status of execute equal task. So go to on ssdt, see here we need to add one more package. Then we can rename this package with precedence constant. So let's drag and drop execute equal task. I haven't discussed about the execute equal task, but I'm not going to use this widely. So double click on this execute equal task. And here we can see in general tab, we have connection type. So we want to make connection with our database, then we need to set up the connection. So I want to add new connection. So here I have already made the connection with our database. So I want to use that one. So click on OK. So here we can write our SQL statement. So I want to simply select then hello, then I need to click on OK. Now click on OK. So I have done execute SQL task. Then I need to use three data flow, first for success, second for failure, then completion. So I need to set these precedence constant with data flow. So we can set all these three. Now we can double click on this precedence constant. Then we can see value for success, failure and completion. So this is for success. Second I need to change for failure. Then move to third and this is for completion. Now click on OK. So we have done our package. Now I need to execute our package to check the output. So as we can see once execute SQL task executed successfully, then success and completion have been executed. Now I can stop this package. Now double click on this execute SQL task. So here I need to generate a custom error. So I can remove this single query, now click on OK, then again OK. Now our failure and completion will be executed this time. So we can save our package and execute. So as we can see execute SQL task executed with failure. So our failure and completion have been executed. Now I can stop this package. Now I need to double click on this precedence constant. So here as we can see we have evaluation operations. So it has constant, expressions, expressions and constants and expressions are constant. So as we can see for constant we have done. Next we need to set up for expressions. So what it mean? So constants, a constant that uses only the execution result of the precedence executables. To determine whether the constant executable run, the execution result of the precedence executable can be success, failure or completion. As we have seen if our execute SQL task has been executed successfully then we are getting our output and we are not going to check for any expression. In our second an expression that is evaluated to determine whether the constant executable run, if the expression evaluated true, the constant executable run. So what it mean? So go to SSDT. So here I need to set up an expression. So if the run equals to one. So once this value will be satisfied, next executable should be executed. As we can see it will return true, first data flow should be executed. So I gonna click on start. So here as we can see execute SQL task has been executed with failure, sour failure and completion have been executed and in our first data flow we have set up for expression. If the expression value will return true then our next task will be executed. So I have set up one equals to one that is true that's why we are getting this output. So I can stop this practice. Next we can see we have constants and expressions. A constant and expression that combines the requirement of execution results of the precedence executables and the return result of the evaluating the expression. Go to SSDT and here I need to click on this precedence constant and I need to change expressions and constants. So it will check expressions as well as constants. If the expression value will be true and constant value will be true then our next executable will be executed otherwise next executable will not be executed. So for this case as we can see our execute SQL task will not be executed successfully that's why our first data flow task will not be executed because our expression value will be true but constants value will not be true. So I can click on OK and click on start. Our first data flow task has not been executed. So I can stop this practice. So this is for constants and expressions. It will check constants as well as expressions if both value will be true only then our next executable will be executed. Next is constants or expressions and expressions or constants that uses either the execution result of the precedence executable returns of the evaluating the expressions. What it means? So it will check output of the constant and expression. If any one of these values will be true then our next executable will be executed. So go to on ssgt and in our first precedence constant double click on this and here we need to change for expression or constant. So in this case as we can see our execute SQL task will not be executed successfully so constant value will not be true but the expression value will be true because I have specified 1 equals to 1. So I need to click on OK. So our first data flow task should be executed. Now click on start. So as we can see first data flow task has been executed successfully. Now I can stop this practice. Next we have multiple constants. If the constant task has multiple constants then we can choose below options. First is logical and and we can select logical or. So what it means? So go to on ssgt so here I can delete this data flow task and this data flow task as well and I can delete this constant. I need to use one more execute SQL task and here again I need to make the connection so we can connect and here I need to specify our query. So I need to select select hello now click on OK then again OK and we need to select this precedence constant with our data flow task and for second execute SQL task again we need to select for data flow task. I need to double click on any of these two precedence constants and we can see here we have an option for logical and second option is logical or. So first time it will check and so if these two execute SQL task will be executed successfully only then our data flow task will be executed so save this package and click on start. So our first execute SQL task has not been executed successfully that's why our data flow task has not been executed. So let's correct this error. We can put a single quote and click on OK now our data flow task should be executed. So as we can see data flow task has been executed successfully. Now double click on this and I want to select for logical or so this time it will check any of these two will be executed successfully then our data flow task will be executed. So double click on this and create a custom error so it will return an error. So our first execute SQL task will not be executed successfully but data flow task will be executed successfully. So click on start as we can see execute SQL task has not been executed successfully but our data flow task has been executed so I can stop this package. So thank you so much for watching this video. If you like this video please subscribe our channel to get many more videos. Don't forget to press the bell icon to get the notification of our newly uploaded videos. Thank you so much.