 Hello, welcome to SS Unity, social decide and this is continuation of SSIS tutorial. So today we gonna discuss about error handling and this is very important topic in SSIS. So let's start with error handling. Error might occur in SSIS because when we are extracting data from the source or we are loading data into destination or we are trying to perform some transformation. So this is because of unexpected data and it's bad practice to fail the package when error occur. So how we can handle the errors? So here we have two ways to handle the errors. First we can configure source, transformation and destination by using fail component, ignore failure and redirect roles. So we will discuss later in this video series. Next is by using onerror event in error handler at the package level or task level. So we will discuss this in next video. So let's start with our first scenario. So here we have a scenario, we have a flat file source. So this is our flat file and we want to extract data from this flat file and load into SQL server table as I have already created the table. So this is our table and it has 5 rows as we are having in our flat file. First we will create our package, once our package will be executed then data should be loaded in this table. After that we will create a custom error on the flat file then we will handle that error. So go to SSDT and here I would like to add one more package then call this package as error handling. So this is our error handling looks good. Now I need to use a dataflow task, now double click on this dataflow task. So here I need to fetch data from flat file source so we can drag and drop and we want to load data into SQL server table. So we have to use already be destination. So double click on this flat file source. Here we need to make flat file connection manager so we need to click on new. Here we need to select file name with folder. So this is our file so we can click on open then go to own columns. So looks good. Now go to on advance. In advance as we can see for ID we are having data type as string. So I need to change this data type with integer now click on OK. So we have done our connection manager. Now I need to click on OK. So we have done our source. Now we need to configure our destination. So we can connect with destination and double click on this already be destination. It would ask for already be connection manager so click on new. As I have already made the connection so I am going to use that one click on OK. Here we need to select the table where we want to load the data. So I want to load data in raw file table. So this is our raw file table. Go to on mapping, mapping succeed. Looks good. Now click on OK. So we can save this package and click on start. So package executed successfully. So five rows should be loaded in our table. Stop this package go to on table and now we can refresh. So data have been loaded successfully in this table. Now go to on flat file and here I need to create a custom error. So in ID field as we can see we are having only integer values. So I need to change this integer value with alphanumeric values. So these two rows has alphanumeric values. Now we can cancel and go to on ssgt. So this time once our package will be executed then flat file source will be filled because we are not having integer values in ID field. Now we can click on start. So as we can see flat file source filled. Stop this package. Now double click on this flat file source. Here we can see we have connection manager then columns then error output. In error output we can see we are having error and truncate. So in error if error will be occurred then what we want to perform. So here we have three options. First is fail component then ignore failure then redirect rows. So first as we have seen fail component. If any error will be occurred in ID field then that component will be failed. Second ignore failure. So we can select ignore failure and click on OK. Now we can save this package and click on start. Five rows should be loaded in our SQL Server table. Stop this package. Go to on table. Now I can refresh this table and this time we are having these five rows. Once we are not getting proper data as we have seen in our flat file we are not having proper integer values we have alphanumeric values that's why that values will be replaced by null in our destination. So this is our destination. Now in our third option we have redirect rows. So don't click on this go to on error output and this time I would like to redirect rows to error output now click on OK. So we have done I don't want to load data with any physical destination I just want to check the data so we can use multicast then I wish to connect with error output and here it would load the data if you will not get proper data as we are expecting now click on OK. Here we can enable data everywhere now we can save it click on start. So as we can see two rows moved to error output. So this is our error output and we can check the error description as well. So we are having data values cannot be converted reason of the incorrect data types. So two rows moved to flat file error output and three rows goes to our destination. Now we can stop this package now go to on SSMS and this time refresh this table. So three rows inserted in our table and two rows moved to error output. So this is if we are not getting data as we are expected in terms of data type. Second we have truncation issue. So go to on flat file connection manager and here as you can see inside this column we are having all the columns then advance we are having first name. So output width is 50 so I would like to change with 10 now click on OK. Not double click on this flat files OK in error output as we can see truncation issue. In truncation we are also having three options as we have seen in errors. First is fail component then ignore failure redirect rows. So I would like to use with fail component. If we are having more than 10 characters in first name then our task will be failed. Now click on OK go to on flat file and here I would like to increase the length of this save it and close. Now click on start so our package failed now we can stop this package and this time I would like to change with ignore failure. Now click on OK now we can execute our package. So as we can see five rows goes to our destination. Now we can stop this package and go to our destination and now we can refresh our table. And here as we can see this is our record and we are having only 10 characters. So in first name it will insert only 10 characters if we are having more than 10 characters then that data would be lost. This is our case 2 when we ignore the error. In our third I would like to redirect rows to error output now click on OK save it and click on start. So here so one row moved to error output and we can see error description data was truncated looks good stop this package. So I hope you have understand how we can handle the errors if error will be occurred in our package. So thank you so much for watching 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.