Wednesday, March 21, 2012

SSIS package total Execution time


         
Following code can be used in Script task to get the SSIS total execution time to log in database table.
            DateTime Sdt;
            DateTime Cdt;

            Sdt = Convert.ToDateTime(Dts.Variables["StartDateTime"].Value);
            Cdt = DateTime.Now;

            TimeSpan timeDiff = Cdt.Subtract(Sdt);


            Dts.Variables["RunDuration"].Value = timeDiff.TotalSeconds.ToString("0,0.0") + " S";

No comments: