SQL Server Integration Services – Sample 2


This Chapter we are going to discuss about some more useful control flow items together with easy examples.

  1. For Loop Container: which ever language programmer using they will know about For Loop iteration. Same way this For Loop Container also running. InitExpression (initialization), EvalExpression (condition) and AssignExpression (iteration)

Here I have created the variable @Counter for looping purpose.

    This package I have used Script task (Get Folder List) with simple script to get the folders list from specified path. (Just for demo)

using ‘Design Script…’ to write Vb.Net Script to achieve the objective of this package.

I have written following script inside the sub Main()

Public Sub Main() ‘ ‘ Add your code here ‘ Dts.TaskResult = Dts.Results.Success Dim Dir As Directory Dim SDir As String Dim SDirs As String If Dir.Exists("C:\PHP") Then For Each SDir In Dir.GetDirectories("C:\PHP") SDirs += SDir & vbCrLf Next End If MsgBox("Directories List : " & SDirs) End Sub

Just right click on for loop container to test the script using ‘Execute container’

Script will be return directory list from specified path (Just for demo – In real time scenario avoid messages.)

Completion of successful execution will be displayed with Green color.

This chapter we have learned additionally how to test the task (or) container (or) package (Right click will be varied dynamically depend the selection)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s