Tải bản đầy đủ (.pdf) (10 trang)

Hands-On Microsoft SQL Server 2008 Integration Services part 2 doc

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (199.85 KB, 10 trang )

x Hands-On Microsoft SQL Server 2008 Integration Services
Chapter 4 Integration Services Control Flow Containers . . . . . . . . . . . . . . . . . . . . 109
Integration Services Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Foreach Loop Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Hands-On: Contacting Opportunities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
For Loop Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Hands-On: Deleting Data Month by Month After Archiving . . . . . . . . . . . . . . . . . . 124
Sequence Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Task Host Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Chapter 5 Integration Services Control Flow Tasks . . . . . . . . . . . . . . . . . . . . . . . 135
Categories of Control Flow Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Data Flow Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Data Preparation Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Workow Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
SQL Server Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Scripting Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Analysis Services Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Transfer Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Maintenance Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Backward Compatibility Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Custom Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Control Flow Tasks in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
FTP Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Preparations for the Hands-On Exercises in This Chapter . . . . . . . . . . . . . . . . . . . 143
Hands-On: Downloading Zipped Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Execute Process Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Hands-On: Expanding Downloaded Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
File System Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Hands-On: Archiving Downloaded Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Web Service Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160


XML Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Input Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Second Operand Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Output Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Operation Options Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Execute SQL Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
General Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Contents xi
Parameter Mapping Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Result Set Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Expressions Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Bulk Insert Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Message Queue Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Hands-On: Importing Expanded Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Execute Package Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Hands-On: Consolidating Workow Packages . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Send Mail Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
WMI Data Reader Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Hands-On: Reading the Application Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
WMI Event Watcher Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Transfer Database Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Transfer Error Messages Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Transfer Jobs Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Transfer Logins Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Transfer Master Stored Procedures Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Transfer SQL Server Objects Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Back Up Database Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Check Database Integrity Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Execute SQL Server Agent Job Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Execute T-SQL Statement Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

History Cleanup Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Maintenance Cleanup Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Notify Operator Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Rebuild Index Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Reorganize Index Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Shrink Database Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Update Statistics Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Chapter 6 Administering Integration Services . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Connecting to Integration Services Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Managing Packages with Default Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Managing Packages Saved on a Remote Server . . . . . . . . . . . . . . . . . . . . . . . . . 227
Managing Packages on an Instance of an SQL Server . . . . . . . . . . . . . . . . . . . . . . 228
Connecting to Integration Services on a Remote Server . . . . . . . . . . . . . . . . . . . . 228
xii Hands-On Microsoft SQL Server 2008 Integration Services
Managing SSIS Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Hands-On: Working with Integration Services Storage Folders . . . . . . . . . . . . . . . . 229
dtutil Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Hands-On: Using dtutil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Running SSIS Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
SQL Server Import and Export Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
BIDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Execute Package Utility (DTExecUI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Hands-On: Running an SSIS Package Using the Execute Package Utility . . . . . . . . . . . 246
DTExec Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
SQL Server Agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Hands-On: Automating Running an SSIS Package with SQL Server Agent . . . . . . . . . . 257
Executing SSIS Packages Programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Chapter 7 Securing Integration Services Packages . . . . . . . . . . . . . . . . . . . . . . . 269

Digitally Signing the Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Excluding Sensitive Information from the Package . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Encrypting Sensitive Information in the Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Encrypting All the Information in the Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Hands-On: Working with Package Protection Levels . . . . . . . . . . . . . . . . . . . . . . 273
Using Integration Services Fixed Database-Level Roles . . . . . . . . . . . . . . . . . . . . . . . . . 282
Fixed Database-Level Roles and Their Permissions . . . . . . . . . . . . . . . . . . . . . . . 282
Hands-On: Control Access to a Package with User-Defined Roles . . . . . . . . . . . . . . . 283
Considerations for Different Storage Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Considerations for Saving to SQL Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Considerations for Saving to the File System . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Chapter 8 Advanced Features of Integration Services . . . . . . . . . . . . . . . . . . . . . 291
Logging and Log Providers in SSIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Hands-On: Configuring Logging in a Package . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Transactions in Integration Services Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Hands-On: Maintaining Data Integrity with Transactions . . . . . . . . . . . . . . . . . . . 301
Restarting Packages with Checkpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Hands-On: Restarting a Failed Package Using Checkpoints . . . . . . . . . . . . . . . . . . 313
Contents xiii
Expressions and Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Hands-On: Extending the Contacting Opportunities
Package with Property Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Handling Events at Package Run Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Hands-On: Creating Event Handlers in an SSIS Package . . . . . . . . . . . . . . . . . . . . 325
As a Data Source for Reporting Services Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Enable SSIS as a Data Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Using SSIS as a Data Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Chapter 9 Data Flow Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

From Control Flow to Data Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Data Flow Component Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
External Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Error Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Considerations for Bringing Data into Data Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Data Flow Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
ADO NET Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Excel Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Flat File Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
OLE DB Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Raw File Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Script Component Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
XML Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Data Flow Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Business Intelligence Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Row Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Rowset Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Split and Join Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Auditing Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Data Flow Destinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
ADO NET Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Data Mining Model Training Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
DataReader Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
xiv Hands-On Microsoft SQL Server 2008 Integration Services
Dimension Processing Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Excel Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Flat File Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
OLE DB Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

Partition Processing Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Raw File Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Recordset Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Script Component Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
SQL Server Compact Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
SQL Server Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Data Flow Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Hands-On: An Introduction to the Data Flow Task . . . . . . . . . . . . . . . . . . . . . . . 368
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Chapter 10 Data Flow Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Row Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Copy Column Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Character Map Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Data Conversion Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Derived Column Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Export Column Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Import Column Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Script Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
OLE DB Command Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Split and Join Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Conditional Split Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Multicast Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Union All Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Merge Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Merge Join Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Cache Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Lookup Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Hands-On: Updating PersonContact Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Rowset Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Sort Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415

Percentage Sampling Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Row Sampling Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
Contents xv
Pivot Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Hands-On: Pivoting Sales Order Records in an Excel Worksheet . . . . . . . . . . . . . . . 420
Unpivot Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Aggregate Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Hands-On: Aggregating SalesOrders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Audit Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Audit Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Row Count Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Business Intelligence Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Slowly Changing Dimension Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Hands-On: Loading a Slowly Changing Dimension . . . . . . . . . . . . . . . . . . . . . . . 443
Data Mining Query Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Term Lookup Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Term Extraction Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Fuzzy Grouping Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Fuzzy Lookup Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Hands-On: Removing Duplicates from Owners Data . . . . . . . . . . . . . . . . . . . . . . 468
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Chapter 11 Programming Integration Services . . . . . . . . . . . . . . . . . . . . . . . . . . 481
The Two Engines of Integration Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Programming Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Developing Custom Objects from Scratch . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Building Packages Programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Extending Packages with Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
The Legacy Scripting Task: ActiveX Script Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Script Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488

Hands-On: Scripting the Handshake Functionality . . . . . . . . . . . . . . . . . . . . . . . 488
Script Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Script Task vs. Script Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
Hands-On: Extending Data Flow with the Script Component . . . . . . . . . . . . . . . . . 507
Script Component as a Data Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
Script Component as a Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Script Component as a Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Debugging Techniques for Script Component . . . . . . . . . . . . . . . . . . . . . . . . . . 530
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
xvi Hands-On Microsoft SQL Server 2008 Integration Services
Chapter 12 Data Warehousing and SQL Server 2008 Enhancements . . . . . . . . . . . . . 535
The Need for a Data Warehouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Data Warehouse Design Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Top-Down Design Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Bottom-Up Design Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Data Warehouse Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Centralized EDW with Dependent Data Marts . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Distributed Independent Data Marts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Data Warehouse Data Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Entity-Relationship Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Dimensional Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Dimension Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
Loading a Dimension Using a Slowly Changing Dimension . . . . . . . . . . . . . . . . . . . . . . . 545
Data Model Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Star Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Snowflake Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
Building a Star Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
SQL Server 2008 R2 Features and Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
SQL Server 2008 R2 Data Warehouse Editions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
SQL Server 2008 R2 Datacenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551

SQL Server 2008 R2 Parallel Data Warehouse . . . . . . . . . . . . . . . . . . . . . . . . . . 552
SQL Server 2008 R2 Data Warehouse Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Fast Track Data Warehouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
Parallel Data Warehouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
SQL Server 2008 R2 Data Warehouse Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Backup Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
MERGE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
GROUP BY Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Star Join Query Processing Enhancement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
Change Data Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
Partitioned Table Parallelism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
Chapter 13 Deploying Integration Services Packages . . . . . . . . . . . . . . . . . . . . . . 567
Package Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
Types of Package Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Hands-On: Applying Configurations to Contacting Opportunities . . . . . . . . . . . . . . 572
Contents xvii
Direct and Indirect Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
Hands-On: Using Indirect Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
Deployment Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
Deploying Integration Services Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Hands-On: Deploying an Integration Services Project . . . . . . . . . . . . . . . . . . . . . 589
Custom Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
Chapter 14 Migrating to Integration Services 2008 . . . . . . . . . . . . . . . . . . . . . . . 595
Upgrade Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Hands-On: Analyzing DTS 2000 Packages with SQL Server 2008 Upgrade Advisor . . . . . 597
Migrating Data Transformation Services Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
Migration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
Installing DTS 2000 Support Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601

Running DTS 2000 Packages As-Is with Run-Time Support . . . . . . . . . . . . . . . . . . 604
Hands-On: Executing a DTS 2000 Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
Embedding DTS 2000 Packages in Integration Services Packages . . . . . . . . . . . . . . 609
Execute DTS 2000 Package Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
Hands-On: Executing Importing Contacts Using the Execute DTS 2000 Package Task . . . 610
Migrating DTS 2000 Packages to Integration Services . . . . . . . . . . . . . . . . . . . . . 614
Package Migration Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
Hands-On: Migrating Importing Contacts to Integration Services . . . . . . . . . . . . . . 617
Upgrading Integration Services 2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
Same-Server Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
Different Server Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
Upgrading SSIS 2005 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Chapter 15 Troubleshooting and Performance Enhancements . . . . . . . . . . . . . . . . 631
Troubleshooting Integration Services Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
Debugging Features Available by Default . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
Debugging Tools Requiring Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
Hands-On: Setting Breakpoints to See Variables Values . . . . . . . . . . . . . . . . . . . . 634
Performance Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
It’s All About Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
Architecture of the Data Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Synchronous and Asynchronous Transformations . . . . . . . . . . . . . . . . . . . . . . . 645
xviii Hands-On Microsoft SQL Server 2008 Integration Services
Classifying Data Flow Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Optimization Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Performance Monitoring Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Performance Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
SQL Server Profiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660
Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
Execution Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662

Hands-On: Monitoring Log Events in a Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . 663
Using Parallel Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
Running Parallel Tasks in the Control Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
Creating Multiple Data Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
Enhancing EngineThreads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
Appendix How to Use the Provided Software . . . . . . . . . . . . . . . . . . . . . . . . . . 673
Downloaded Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674
Attaching Campaign Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
xix
Acknowledgments
I
would like to thank my wife Sarita for being supportive and doing the major work
of maintaining the household while I was busy with the book revision work. My
kids Toozy, Ritzy, and Himnish also deserve acknowledgments here for being
co-operative and patient with me. Special thanks go to the readers of the first edition—
especially the ones who have taken time to give their valuable feedback. The feedback
coming in through various channels has actually inspired me to revise the first edition
to this new edition in line with the release of SQL Server 2008 R2. In the process of
writing and editing the book, technical editor Allan Mitchell has contributed his ideas
and constructive comments that not only have helped to remove some of the mistakes
in the compilation but also have greatly improved the content. I would like to thank
all my colleagues at Avis-Europe, where I learn most while working with them and for
giving their valuable inputs as well. Finally, special thanks to the team at McGraw-Hill
for their hard work and support during this project.

×