Roadmap › SSIS — SQL Server Integration Services › Module: Deployment, Scheduling and Performance
Lessons in this course (13)

12. Script Task and Script Component

IntermediateMediumLesson 12 of 13
  • Script Task (Control Flow) — C#/VB code for workflow logic: check if a file exists, call an API, move files, set variables (Dts.Variables["User::FileName"].Value = ...), set Dts.TaskResult = (int)ScriptResults.Success.
  • Script Component (Data Flow) — as a source (generate rows from an API/JSON), transformation (Input0_ProcessInputRow(Input0Buffer Row) to modify rows — e.g. complex regex cleansing), or destination.
  • Declare ReadOnlyVariables/ReadWriteVariables in the editor before using them.
csharp
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    Row.PhoneClean = Regex.Replace(Row.Phone ?? "", @"[^\d]", "");
    if (Row.PhoneClean.Length != 10) Row.IsValid = false;
}