How to Avoid an Error File that is Empty in SSIS Package - Handling Empty Files in SSIS Package

 How to Avoid an Error File that is Empty in SSIS Package - Handling Empty Files in SSIS Package

In this video tutorial, I am going to show you that how you can check if the source file is empty and you can move to some folder and load the files which have the data.

We will use script task and constraints to handle this logic. At the end of Package we move the files to achieve folder after loading them.


C# code used in Scrip Task

Dts.Variables["IsEmpty"].Value = 0;


if (new FileInfo(Dts.Variables["FilePath"].Value.ToString()).Length == 0)

            {

                Dts.Variables["IsEmpty"].Value = 1;

            }



Constraints

@[User::IsEmpty]==1 -- file is empty

@[User::IsEmpty]==0 file is not empty




How to Import Data from MySQL Table to SQL Server Table by using Import Wizard - MySQL To SQL Import

How to Import Data from MySQL Table to SQL Server Table by using Import Wizard. In this video you are going to learn how you can import data from Mysql table to SQL server 2019 by using import export wizard. You will be using ADO.Net drive on MySQL Source and then write query to get the data from MySQL table and map to SQL Server table.

To read the data from MySQL Table, you need a user and have to provide read permission to user that you will use in Import Wizard.


Script to create user in mysql and provide permissions

create user 'tb'@'localhost' identified by 'dba123'; grant all on techbrothersit.* to 'tb'@'localhost'; flush privileges; show grants for 'tb'@'localhost';