 Hello, welcome to SSMunitech. So, see this side and this is continuation of SSI's tutorial. So today we gonna discuss about how we can load data into database from flat files. In our last video we have also discussed how we can load data into database from flat files but the format was delimited. So today we gonna discuss how we can load data when flat file formats are fixed width and right right. Let's start. So again we are dealing with movement of data. So we have to use a data flow task inside the control flow panel and when we move to data flow panel then we have to use a flat file source and then LEDB destination. In flat file source we want to connect with our flat file from which we want to get the data and then from LEDB destination where we want to load the data. In fixed width each row contains one complete record of the information and each row contains one or many piece of data also referred to a column or feeds. Each data column has a defined width specified as a number of characters that is always same for all the rows. If we open our fixed width file then so this is our fixed width file. Now we want to open in notepad++. So here as we can see for ID we have 11 characters and then for name we are having 100 characters then for salary we are having 12 characters and at last we have two characters one for CR then LF. So we want to load this file in our database. So how we can load it? We have a table flat file to database table. So initially we don't have any record and it contains three columns ID, name and salary and we want to load data in this table. So how we can load it? Let's move to SHGT. So this is our SHGT. Now I'm going to create a new package. So I need to rename with flat file to database with fixed width and right right. So as we have discussed in control flow panel we need to use a dataflow task. So we can drag and drop our dataflow task and this is for fixed width. So we can also rename with fixed width. Once we double click on this it will directly move to dataflow panel. Inside dataflow panel we need to use flat file source. So go to other sources then flat file source we can drag and drop and then we need to make the connection to connect with our flat file. So double click on this and it will ask for flat file connection manager. So we don't have any connection manager right now. So create new one. Once we click on new our flat file connection manager editor window will be open. It will ask for file name. So we can browse and select our file. So this is our file fixed width. Now we can open it. Once we open so we need to select the file format should be fixed width. So we can select fixed width and we can see our text qualifier is disabled. So text qualifier is only enabled once we are dealing with delimited. Once we move to drag drive then also it's disabled. Now we move to columns. So inside columns as we can see we have total how many characters. So we can see 123 is the total length. So we have to select 125 because 123 for this data and 2 for this delimiter. So we need to select 125. So this is 125 now. So here we need to select 11 as we can see in our flat file for ID how many characters. Once we count it should be 11. So we need to select 11 and second 400. So we need to select with 100 plus 11. So triple one and go to on advance. Once we move on advance then we can see we have ID name and Celtic. We can preview as we can see it looks good. So click on OK. Once we click on OK then we have option to retain null values from the source as null values in the data flow. So we can select this checkbox go to on columns. So we are getting ID name and salary. We are OK with it. Click on OK. Now we have done our source path. Now move to destination. So we want to load data in our validated destination. So we can drag and drop and then make the connection. Once we connect then we need to make the connection to connect with our database. So double click on this and go to on validated connection manager. Click on new. We have already make the connection. So delete this one and create new one. Here we need to select the server name. Once we select the server name then it will ask for database name by which we want to connect. So we want to connect with SSIS test. So we can check the connection. Connection succeed. Click on OK. Again OK and OK. So here we have make the connection with our database and then from which table we want to load the data we can select over here. So this is our table. Go to on mapping. So inside mapping as we can see we need to map the columns. So ID should be mapped with ID. Then name should be mapped with name. Then salary should be mapped with salary. So we have done the mapping. Now click on OK. Once we click on OK. So we have done our practice. Now we need to execute. Once we execute as we can see 18 rows. So 18 rows should be loaded in our table. It is we don't have any data. So now 18 rows should present over here. So we can see and we can count 18. So it looks good. So we have done our fixed width. Now we move to ragged write. In ragged write each row contains one complete record of the information as we have discussed in fixed width. Each row contains one or many piece of data also referred as a column or field. Each row column has a defined width specified as number of characters. That is always the same for all the rows. This is our difference between fixed width and ragged write. Last column value is variable in case of ragged write. We can disable this data flow task. So right click on this and disable. Now we need to drag and drop one more data flow task for ragged write and we can rename with ragged write. Once we double click on this, it will directly move to data flow panel. So inside data flow panel, we need to select our source and destination. So our source is flat file. So we can drag and drop. Now we need to make the connection. So double click on this. As we have already make the connection for fixed width. So we don't want to use it. Create new one. Click on new. And then it will ask for file name. So browse and this is our file name. So click on open. Once we click on open, then we need to select the format. So format should be a ragged write. Click on OK. So now we move to columns. Now we need to select the column size. So first should be 11. Then move to our next. That should be triple one. And our last column value should be variable. No need to select that value. Now we can click OK. Once we click on OK, then we need to select this checkbox. Once we select this checkbox, then go to one columns. So we are getting ID name and salary and click on OK. Once we click on OK, our source part has been done. Now we need to make the connection with destination. So already be destination dragon drop this and we need to connect once we connect. Then we need to make the connection with the database. So here we need to set the table as we have already make the connection for SQL server. Then I'm going to use that one. Just only select the table name. So we want to load the data with the same table as we have used in fixed width. So we can select go to one mapping. Now we need to map with ID then name. And salary is automatically mapped. So no need to worry about it. Click on OK. Once we click on OK, then as we can see we have 18 rows. Now we need to delete this data. So delete from table. Once we delete, now we don't have any data right now. Now execute this package. Once we execute this package, we can see 47 rows. So 47 rows should be inserted in our SQL server table. Go to SQL server, execute and we can check 47 rows. So data has been loaded in our SQL server table. Stop this practice and so I hope you have understand how we can load data into database from flat files when formats are fixed width or right right. So thank you so much for watching this video. If you like this video, please subscribe our channel to get many more videos.