 Hello, welcome to SSUnitech, so she'll decide. And this is continuation of SSIS tutorial. So today we're going to discuss about how we can load data from database to flat files. In our last video, we have discussed how we can load data from flat file to our database. And we have also understand about the flat file formats and connection managers as well. If you haven't watched part three of this video series, so I would strongly recommend to watch that video where we can understand how we can load data from flat file to database and flat file formats, which is very important. And today we will also understand about the fixed width and right right formats and make the difference between these two. So let's start. We have to use a data flow task because we are dealing with movement of data. When data will move from any source to destination, then our data flow task will be used. So as we can see inside the control panel, we have to use a data flow task. And when we move to data flow panel, then we have to use our source and destination. So we are going to get the data from database. So we have to use LEDB source. And we want to load the data in our flat file. So we have to use flat file destination. So let's move to SSGT. So this is our SSGT. And we need to create one more package. So now we can right click on this SSIS package, new SSIS package and our package is created. Now we need to rename this package. We are getting the data from database and then we are going to load data in our flat file. And format should be delimited. So this is our package. So now we need to use a data flow task because we are going to transfer the data. Once we double click on this, it will directly move to data flow panel. So here we want to get the data from database. So we need to use LEDB source. So this is our LEDB source. Once we double click on this, then it will ask for connection manager. And initially we don't have any connection manager. So we need to create a new connection. Once we click on new, then we can see we have already made a connection. So this time I am going to delete and create new connection. Once click on new, so it will ask for connection manager. First server name. So we can select the server name. Once we click on server name, so it will ask for database name by which we want to connect. So we want to connect with SSIS test. We can test the connection. Connection succeed. So click on OK. So we have made our connection. Now click on OK. Next it will ask from which table we want to get the data. So we want to get the data from EMP data table. Now we can preview and we can see. So we have four columns in this table. First is ID, second name, then date of birth and then cell D. So we want to load this data in our flat file. We can see our columns. So we want all the columns. So we can select all the columns. If we want to skip any column, then we can unselect this checkbox. And this time we have only three columns and we don't want date of birth. So we can uncheck this one. Click on OK. So we have done our source part. Now we need to make a connection for our destination where we want to load the data. So this is our flat file destination. We can drag and drop this. And then once we double click on this flat file destination, then it will ask for flat file connection manager. Once we click on new, then it will ask for flat file format. So we have four type of flat file format. First is delimited. Second is fixed width. Then fixed width with row delimited. Then right right. So we will cover one by one. So first I am going to load the data in delimited. So click on OK. It will ask for file. So in our destination folder, I am going to create a file with data base to flat file delimited. First row, so column name. So here we can see we have the columns and we have only three columns because we don't want to load the data for date of birth. So that column is removed in our source. Once click on OK, then go to on mapping, mapping succeed. Click on OK. So now I am going to execute this practice. Once we execute this practice, 47 rows inserted in our flat file. So this is our destination folder where we can see, so here we have database to flat file delimited. So here we can see we have comma delimited file and we can see we have all the records. Now we can close it and now we can rename this with delimited. So I am going to disable this data flow task and create new one. And this time we will load data from fixed width. So this is our source, quality db source. Once we double click on this, then we have already make the connection. So we need to select only table name. So this is our table name. Go to on columns. We don't want data birth. Click on OK. Now I am going to make connection for flat file destination. And then we can connect and double click on this because we have already a connection in this package. So it's shown over here, but we won't create new one. And this time I am going to load data from fixed width. Click on OK. And create a new file with database to flat file and this time fixed width. Click on OK. First row should be column name. Go to on columns. We are OK with it. Click on OK. Go to on mapping. So we have done the mapping and click on OK. Now I am going to execute this package. 47 rows affected. Now go to on folder and we have this fixed width. So here we can see we are not getting the data as we expected. So why we are getting with this data? Let's cover later. So we need to rename with fixed width and we have two more formats. So we need to create that one. So this time create one more data flow task. Double click on this. Go to on source query db source. Double click on this and select our table name. So this is our table name. Now go to on columns. We don't want data of birth. Click on OK. Now go to on flat file destination. So flat file destination we can select and once we double click on this we have two connection managers. So it's available over here but we want new one. Click on new. And this time we want to load data from fixed width with row delimiters. Click on OK. Browse. And this time we want to create a new file and fixed width with row delimiters. Open. First rows would be column names. Go to on columns. We are OK with it. Click on OK. Go to on mapping. Then again click on OK. Now we can execute this practice and stop this one. And here we can see. So this is our file. We can open it. So here we can see this is our fixed width flat file format. And but we have one more additional column over here. Flat file format which is a red right. So we can disable it and create new one. Click on this and go to on source. So we have already the source. Click on it. Create one more connection. Select the table name. Go to on columns. You don't want data of birth. Uncheck this one. Click on OK. And this time this is our flat file destination. Now we can connect with it and click on this. So this time we have three connection managers because we have already created this one. But we won't create new one. And this time with a right right. Click on OK. It will ask. So we want to create a flat file with right right. So this is our right right. First of all should be column names. Then columns. You are OK with it. Go to on mapping. Mapping succeed. Click on OK and execute this package. So once we execute this package or practice executed successfully. Now go to on files. And make the differences between these files. So now I am going to open these files in notepad plus plus. So this is our notepad plus plus. Open this one. So here we can see we have id name salary. We have two more characters in our delimited file which is CRLF which indicates for new line characters. So this is our delimited file. So now I am going to open 65th file and it will notepad plus plus. So here we can see we don't have any delimited. That's why we are getting the data in a sequence. So in our first row we have all the data. So this is our column name. And our data is started over here. So we can see this is our data. And so this is our first row and this is our second row because we don't have any delimited over here. So once we move to our row delimited then we can open in notepad plus plus. And here we can see we have all the data but we have a extra column over here which indicates the row delimited column. And this is our row delimited column and we have two characters. First is for CR then LF. So we are getting two more characters over here. So this is the difference between fixed width row delimited and fixed width flat file format. And go to on right right and open this file in notepad plus plus. So here we can see in our last column we have the variable values. If you are not getting any value then this column contains zero length. If we have the value then it has the value like 5000 for this row. So we have 5000. So this is the difference between right right and fixed width flat file format. Once we deal with fixed width then we can see our last row contains the full length like cell D contains we can count how many characters. We have 11 characters. So it will take 11 characters in each either it has the value or not. But in right right for this we have only 4 characters so we can see over here. So I hope you have understand about these file formats and how we can differentiate between these. So thank you so much for watching this video. If you like this video please subscribe our channel to get many more videos. Thank you so much for watching.