網頁

2012年4月24日 星期二

Simple Execute SQL Task in SSIS (part 2 of 2)

(4).Configure the second “Execute SQL Task” object
Right-Click the second “Execute SQL Task” to select “Edit…” in menu or Double-Click “Execute SQL Task”
ScreenHunter_22 Apr. 20 20.06Select the right value as Connection, SQLSourceType, FileConnection next to click “OK” button
ScreenHunter_34 Apr. 20 20.40(5).Create SSIS Variable and configure the related setting
Create Variable

In main menu, select “SSIS” –> "Variables”
ScreenHunter_24 Apr. 20 20.15Click Control Flow surface anywhere next to click “Add Variables” button
ScreenHunter_27 Apr. 20 20.25Key in “strFile” Name and select “String” Data Type
ScreenHunter_28 Apr. 20 20.27Configure Foreach Loop Container
Right-Click the “Foreach Loop Container” to select “Edit…” in menu or Double-Click “Foreach Loop Container”
ScreenHunter_32 Apr. 20 20.32Click “Collection”, select “C:\SQLFILE” Folder and assign “ *.sql ” Files
ScreenHunter_13 Apr. 24 15.25Click “Variable Mappings”, select “User::strFile”  variable and click “OK” button
ScreenHunter_33 Apr. 20 20.33Configure Connection Manager
Click “SQLFILE” Connection --->  Managers, Expresssions ---> “…” button
ScreenHunter_02 Apr. 24 14.51The property Expressions Editor will show up
ScreenHunter_03 Apr. 24 14.57Select “Connection String” in Property and click “…” button
ScreenHunter_04 Apr. 24 14.58Drag and Paste “User::strFile” from Variables to “Expression” surface next to click “OK” button
ScreenHunter_05 Apr. 24 15.03So does that “@[User::strFile]” will show on Expression now.
ScreenHunter_06 Apr. 24 15.07(6).Create file format with SQL languageIn “C:\SQLFILE” path, create “three” SQL Server Query File
ScreenHunter_07 Apr. 24 15.12In each file, the content is as follows
ScreenHunter_08 Apr. 24 15.14ScreenHunter_09 Apr. 24 15.14ScreenHunter_10 Apr. 24 15.15(7).Build and Start with debugging
When we execute “Build and Start” this SSIS package, the result is successful.
ScreenHunter_14 Apr. 24 15.29In Microsoft SQL Server Management Studio, the table “TestSQLTask” will be created and the value will be inserted now.
ScreenHunter_15 Apr. 24 15.30

沒有留言:

張貼留言

Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.