Quantcast
Channel: Welcome To TechBrothersIT
Viewing all articles
Browse latest Browse all 1876

How to Use Variables in Script Task in SSIS Package (C# and VB NET Scripting Language) - SQL Server Integration Services(SSIS) Tutorial

$
0
0
In this video we will learn about usage of variables in Script Task in SSIS Package

How to create variables in SSIS Package
How to use variables as ReadOnlyVariables and ReadWriteVariables in Script Task
How to set the value of variable from Script Task in SSIS Package



How to use Variables in Script Task in SSIS Package by using C# Scripting Language

publicvoid Main()
{

//Set the value of local variables in SSIS Script from SSIS Variables
string FileName;
string FolderPath;

FileName=Dts.Variables["User::FileName"].Value.ToString();
FolderPath = Dts.Variables["User::SourceFolder"].Value.ToString();


//Set the Value of variable from Script Task in SSIS Pacakge
Dts.Variables["User::FileFullPath"].Value = FileName + FolderPath + "I have set value";
MessageBox.Show(Dts.Variables["User::FileFullPath"].Value.ToString());
Dts.TaskResult = (int)ScriptResults.Success;
}

How to use Variables in Script Task in SSIS Package by using VB NET Scripting Language

PublicSub Main()
Dim filename AsString
Dim SourceFolder AsString
'Set the value of local variables in SSIS Script from SSIS Variables
filename = Dts.Variables("User::FileName").Value.ToString()
SourceFolder = Dts.Variables("User::SourceFolder").Value.ToString()


'Set the Value of variable from Script Task in SSIS Pacakge
Dts.Variables("User::FileFullPath").Value = SourceFolder + filename
MessageBox.Show(Dts.Variables("User::FileFullPath").Value.ToString())
' Add your code here
'
Dts.TaskResult = ScriptResults.Success
End Sub


How to use Variables in Script Task in SSIS Package by using C# or VB.NET Scripting Language

Viewing all articles
Browse latest Browse all 1876

Trending Articles