Microsoft SQL Server 2000 Data Transformation Services- P15

31 409 0
Microsoft SQL Server 2000 Data Transformation Services- P15

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

//Destination column type is 8-byte real. *pdAverage = (double) cint; for (j = 0; j < m_iDecimals; j++) { *pdAverage = *pdAverage / 10; } memcpy(pDestData, pdAverage, *pulLength); break; default: *pdAverage = (double) cint; for (j = 0; j < m_iDecimals; j++) { *pdAverage = *pdAverage / 10; } memcpy(pDestData, pdAverage, *pulLength); break; } *pulStatus = DBSTATUS_S_OK; //END ADDED CODE---------------------------------------------- return NOERROR; } Adding the Project’s Error Definitions If you want to return specific error codes for conditions that occur in your custom transforma- tion, add them in the *.idl file following this line: import “ocidl.idl”; The code that defines the errors for the AvgXform task is shown in Listing 32.5. L ISTING 32.5 The Error Definitions for the Custom Task //-----------Error codes for the Average Transform--------------------- typedef [helpstring( “Error codes generated by the average transform”)] enum DTSAvgTransformError { DTSAvgXform_Error_WRONG_NUM_DEST_COLS = 0x80041001, DTSAvgXform_Error_NOT_CORRECT_TYPE = 0x80041002 } DTSAvgXformError, *LPDTSAvgXformError; //--------------------------------------------------------------------- Extending the Power of DTS P ART VI 676 L ISTING 32.4 Continued 39 0672320118 CH32 11/13/00 5:04 PM Page 676 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Registering the Custom Transformation The ATL COM wizard creates the code to register the custom transformation during the build process. You can register the transformation on other computers by using the regsvr32 command-line utility: regsvr32 <Path>\Average.dll Unlike the registration of custom tasks, there are no special registry entries that need to be created for a custom transformation. Conclusion DTS provides many excellent built-in tools. One of the best characteristics of DTS, though, is its extensibility. You can build new tools within the DTS environment to handle new data trans- formation situations more effectively. Build a custom transformation when you need the best possible performance, or when you are using a particular ActiveX transformation script repeatedly. Creating a Custom Transformation with VC++ C HAPTER 32 32 C REATING A C USTOM T RANSFORMATION 677 39 0672320118 CH32 11/13/00 5:04 PM Page 677 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 39 0672320118 CH32 11/13/00 5:04 PM Page 678 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. INDEX A aborting Transform Data task, 191 accessing COM objects, 27 files, 360 package log files, 456-458 AcquireConnection method, 122 activating debugging, 55 Active Template Library, see ATL ActiveX Script task, 40, 50 constants, 42 creating, 346-348, 362-363 Data Driven Query task, 214, 221-222 debugging, 558-561 destination columns, 202 empty strings, 203-204 errors, 555 executing, 182-183 failure precedence constraints, 476 full outer joins, 206 global variables, 196-197 lookups, 199-200 null values, 203-204 objects, 42 Package Object Browser, 47, 49 programmatic identifier, 622 properties, 172, 347, 496 strings, 202-203 Transform Data task, 260-263 transformations, 152, 172, 183-187 Workflow, 494, 495 writing, 52 40 0672320118 index 11/13/00 4:55 PM Page 679 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. adding 680 adding, 624 assignments, 370 data, 89-90, 220 fields, 277-278, 280 global variables, 347, 496 joins, 91 lookups, 200 objects, 29, 317-320 properties to custom transformations, 665-667 records, 201 ADO recordset, 355-356 AllowIdentityInsert property, 158, 217 Analysis Services Processing task, 40, 44, 93, 413-417, 420-421 analyzing errors, 554-555 Internet clickstream data, 39-40 API calls, 361 appending files, 152 hierarchical rowsets, 249 Application object, 28 creating, 446 hierarchy, 625-628 log files, 21 properties, 626 referencing, 350 architecture, DTS pack- ages, 8, 10 archiving data, 38, 60 arguments, DTSRun utility, 20-21 AS keyword rowsets, 249 assignments constants, 374 data files, 373 Dynamic Properties task, 367-368, 370-371 environment variables, 374 global variables, 372 INI files, 373-374 SQL queries, 372 asynchronous processing, 392 ATL transformation, 662-663, 677 Attributes field (dimension tables), 85-87 AutoCommit Transaction property, 465, 482 automating filters, 415-416 global variables, 55 avoiding dimension tables, 94-98 B batch files, 228, 427 bcp command line utility, 268, 427, 585 binary files, 427 bindings table, 214 browsing meta data, 591, 593 bulk copy, 426 Bulk Insert task, 50, 268 bcp command line utility, 268 connections, 102 creating, 270, 287-290 data, 89 delimited text files, 271 destination files, 270 executing, 26 fixed-length text files, 271 format files, 52, 271-276 programmatic identifier, 622 properties Check Constraints, 281-282 Code Page, 284-285 Data File Type, 285 Enable Identity Insert, 283-284 Keep Nulls, 282-283 Maximum Errors, 286 Rows, 286 Sorted Data, 284 selecting, 269-270 Transform Data task, 268 business analysis data, 64-69, 589 40 0672320118 index 11/13/00 4:55 PM Page 680 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Commit On option 681 C cache, DTS packages, 56 calculating values, 37 Called Package, 385, 386 calling functions, 535 wizards, 504-507 capturing rowsets, 299-300 case sensitivity, 197-198 Catalog property, 108 categories, objects, 612 CCLine property, 407 cdw command-line utility, 505 changing Server property, 368 chaos, 483 Check Constraints property, 281-282 CheckingDurationIn Secs property, 656 CheckingIntervalInSecs property, 656 child packages, 378-383 child rowsets, 249 cleansing data, 89, 91 clearing objects, 317-320 clickstream data, 39-40, 60 CloseConnection property, 496 closing connections, 122-123, 480 clustering data, 67 code events, 42 libraries, 530 pages, 284-285 wizards, 506-507 writing phases, 228 Batch Complete, 228 On Batch Complete, 240-241 On Insert Failure/Success, 228, 239-240 On Transform Failure, 228 Post Source Data, 228, 241-242 Pre Source, 228 Pump Complete, 228, 242 Row Transform, 228 collation, 314 collections Add method, 624 Count property, 624 CustomTask interface, 639-640 Insert method, 624 Item method, 624 methods, 625 New method, 624 Package2 object, 445 Parallel Data Pump task, 252 Parent property, 466, 624 Properties, 625 referencing, 350 transformations, 146-147 columns, 159 creating, 167-169 destination, 139-141, 143 identity, 283 lineage, 600-601 mappings, 519-520 names, 575-577 ordinal numbers, 575-577 prediction queries, 419 properties, 159-160 referencing, 183 rowsets, 249 scripts, 187 source, 139-141, 143 Transform Data task, 138 COM objects accessing, 27 creating, 243 references, 546 command-line utilities cdw, 505 DTSQiz, 505 DTSRun, 53, 427 osql, 427 wizards, 505-506 CommandProperties property, 294 commands, 21-22 CommandTimeout property, 294 Commit On option, 482 40 0672320118 index 11/13/00 4:55 PM Page 681 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Commit Transaction option 682 Commit Transaction option, 485 CommitSuccess property, 496 comparing transfor- mations, 573-574 Component Object Model, see COM components, 370 configuration Connection object, 113-115 packages, 479-481 transactions, 484 Connected property, 112 ConnectImmediate property, 112 Connection object, 27 Bulk Insert task, 102 Called Package, 385 closing, 122-123, 480 collections, 109, 624 creating, 512-513, 633 data, 37, 102, 109-110 DTS Designer, 10, 103-104 Execute SQL task, 102 methods, 122 modifying, 121-122 OLAP data source, 119 OLE DB providers, 102, 114-115, 119, 121 opening, 123 Oracle DB Provider, 121 packages, 628-631 Parallel Data Pump task, 102 properties, 104-114, 294 referencing, 348-349 Server property, 368 text files, 115-119 transactions, 486-487 Transform Data task, 102 troubleshooting, 490 trusted, 20 Visual Basic, 104, 114-115 consolidation, data, 36-37 constants ActiveX scripts, 42 Data Driven Query task, 219-220 Dynamic Properties task, 374 constraints copying, 316 disabling, 281 enabling, 281 failure precedence, 476 monitoring, 281-282 precedence, 471-476 conversion binary files to text, 427 Visual Basic to VBScript, 360-361 Copy Column transfor- mation, 149, 168-169, 573 Copy Database Wizard, 33-34, 45, 52 calling, 504-507 databases, 502-503, 508-509 DTS packages, 511-512 location, 508-509 objects, 510-511 packages, 17 Copy SQL Server Objects task collation, 314 CopySchema, 313 data, 313-314 databases, 310-311 DropDestinationObjects First, 313 executing, 26 IncludeDependencies, 313 objects, 312-315 performance, 310 programmatic identifier, 622 properties, 317 script file directories, 316-317 user default options, 315-316 Visual Basic, 320-323 copying collation, 314 commands, 21 constraints, 316 data, 313-314 databases, 52, 310-311, 316 FOREIGN keys, 316 indexes, 316 logins, 316 objects, 314-315, 502 permissions, 316 PRIMARY keys, 316 tables, 516 triggers, 316 40 0672320118 index 11/13/00 4:55 PM Page 682 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. custom tasks 683 Copying in ActiveX Script transformation, 573 CopySchema property, 313 Count property, 624 covering indexes, 585 Create Process task, 50 CreateCustomToolTip method, 645 CreateProcess object, 428 creating ActiveX Script task, 346-348, 362-363 Analysis Services Processing task, 420-421 Application object, 446 Bulk Insert task, 270, 287-290 columns, 167-169 COM object, 243 connections, 512-513, 553 constants, 374 Copy Column transfor- mation, 168-169 cubes, 656-657 custom transformations, 664 Data Driven Query task, 216-219, 223-226 data files, 7-8, 111, 373 Data Mining Prediction Query task, 421-423 destination columns, 159-160 DTS Designer, 103-104, 534 Dynamic Properties task, 375-376 environment variables, 374 Execute Process task, 407-408, 428-429 Execute SQL task, 292-294, 306-308 files, 151-152 FTP task, 327-331 global variables, 55, 194-197, 372 INI files, 373-374 local variables, 192 LocalCubeTask, 657 lookups, 199-200 loops, 352-355, 542 Message Queue task, 400-403 multiphase data pump, 243 objects, 31, 312-313, 360 packages, 31-32, 497-499, 613 Parallel Data Pump task, 254-257 parameter queries, 217 precedence constraints, 473-474 Read File transforma- tion, 170-171 source columns, 159-160 SQL queries, 372-373 steps, 470 subordinate dimensions, 98 tasks, 11-12, 335, 536, 620-621, 634-635 templates, 32-33 Transfer Databases task, 341-342 Transform Data task, 128-129, 160-165, 201 transformation scripts, 185 transformations, 167-169 UDL files, 111 utility packages, 384-386 variables, 360 Write File transforma- tion, 170-171 CreationDate property, 466 CreatorComputerName property, 466 CRM (Customer Relationship Management), 60 cubes creating, 656-657 fact tables, 84 processing, 413-414 updating, 414 CurrentPhase property, 232 CurrentSource property, 232 custom tasks creating, 634-635 Description property, 639 40 0672320118 index 11/13/00 4:55 PM Page 683 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. custom tasks 684 errors, 650-652 events, 650-652 Execute method, 640-645 interface, 636-637 log files, 650-652 Name property, 637-638 Properties collection, 639-640 referencing, 635, 653-654 registering, 652-653 threads, 653 VBScript, 654-655 Visual Basic, 653-655 custom transforma- tions, 152 creating, 664 error definitions, 676 PreValidateSchema method, 667-669 ProcessPhase method, 672-676 properties, 665-667 registering, 677 starting, 664-665 ValidateSchema method, 669-671 Customer Relationship Management (CRM), 60 CustomTask property, 615-616, 619 CustomTaskUI inter- face, 645-649 D data adding, 89-90, 220 Analysis Services Processing task, 93 archiving, 38, 60 business analysis, 64-69 cleansing, 89, 91 clustering, 67 connections, 37 consolidation, 36-37 copying, 313-314 Data Mining Prediction Query task, 93 decision trees, 67 destination tables, 277-278 duplication, 37 Dynamic Properties task, 370-371, 373 enterprise data flow, 61 errors, 554-555 exporting, 427, 596 history, 68 homogenization, 37 Import/Export Wizard, 519-520 Information Model, 598 Internet, 60 loading, 569-572 marts, 37-38 merging, 206 messages, 396-399 mining, 45, 67-68, 93, 419, 421-423 missing, 205 modifying, 201, 503 moving, 60 OLTP systems, 68 processing, 502 queries, 253, 514-515 reading, 483 returning, 464-465 sources, 102, 191, 419, 460 storage, 60, 72, 74, 76 summarization, 37 transactions, 63-64 transformations, 7-8, 49, 61-63, 228 types, 311 warehousing, 37-38 Web clickstream, 69 see also Meta Data Services Data Driven Query task ActiveX scripts, 214 bindings table, 214 connections, 102 creating, 216-219, 223-226 executing, 26 hierarchy, 617 parameter queries, 214-216 performance, 215, 582 programmatic identifier, 622 source queriesevents, 214 tables, 220-222 transformation status, 219-220 Data File Type prop- erty, 285 Data Lineage Fields field, 82, 85 Data Link files, 109-111 40 0672320118 index 11/13/00 4:55 PM Page 684 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. destination files 685 Data Pump task, 661-662 Data Transform task, 47 Data Transformation Services, see DTS Data Transformation task, see Transform Data task databases copying, 52, 310-311, 316 creating, 341-342 destination, 311, 508 information models, 598-599 location, 508-509 moving, 502-503 objects, 310 properties, 419 queries, 294 replication, 585 repository, 598 source, 311, 508 tables, 310 transferring, 336-337 transformations, 599 upgrading, 36, 502, 504 users, 311 databases servers Bulk Insert task executing, 26 Copy SQL Server Objects task, 26 Execute SQL task, 26 Transfer Databases task, 26 DataDrivenQueryTask object, 218 DataPumpOptions property, 158 DataPumpTask object, 136, 612 DataSource property, 108, 415 DataType property, 159, 197 DateTime in ActiveX Script transformation, 573 DateTime String trans- formation, 148-149, 171, 573 DB providers, 102 debugging, 55 ActiveX scripts, 558-561 Enterprise Manager, 561-563 Package Manager, 561-563 Decimals property, 666-667 decision trees, 67 declaring variables, 192-193, 446, 450, 531 decompression, text files, 427 default settings configuration, 311 Transformation Flags dialog, 145 deleting DTS packages, 21 messages, 399 packages, 443 queries, 218 records, 221 rows, 518 tasks, 645 delimited text files, 271 Description property ActiveX Script task, 347 Connection object, 112 CustomTask interface, 637, 639 Data Mining Prediction Query, 419 Dynamic Properties task, 367 Execute Package task, 380 Execute Process task, 428 Package object, 368, 436-438, 465 PackageInfo object, 445 Send Mail task, 407 Step object, 497 Task object, 619 Transform Data task, 129-130 DesignerSettings prop- erty, 626 destination files, 116 Bulk Insert task, 270 collections, 252 columns, 139-141, 143 creating, 159-160 databases, 311, 508 error rows, 49 Import/Export Wizard, 516-518 objects, 312-313 referencing, 183 40 0672320118 index 11/13/00 4:55 PM Page 685 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... 408 SQL Namespace, 506 Transfer Objects task, 317-320 UnitializeMAPI, 408 Microsoft Access, 36 Microsoft Access 2000, 102 Microsoft Excel 2000, 102 Microsoft Repository, see meta data Microsoft SQL Server, 102 Microsoft Visual Basic Scripting Edition, see VBScript Microsoft Messaging API (MAPI), 406 Middle of String, 149, 151 Middle of String transformation, 169-170 mining models, 413, 419 missing data. .. paths, 394 PDSO (Data Transformation Services Package Data Source Objects), 460 performance Copy SQL Server Objects task, 310 Data Driven Query task, 215, 582 DTS packages, 122-123 Fetch Buffer Size option, 578 697 698 performance Insert Batch Size option, 578 multiphase data pump, 243 packages, 25, 567-568 parallel processing, 251, 583 scripting languages, 583 tables, 578, 584-585 Transform Data task, 126-127,... dialog, 144-146 transformations, 146-147, 573-574 see also Data Pump task; Data Transformation task Transform Failure phase, 231, 233 transformations, 187, 624 Transformation Flags dialog, 144-146 Transformation object ActiveX scripts, 152, 172, 183-187 ATL installation, 662-663 collections, 146-147 comparing, 573-574 Copy Column, 149, 169 creating, 167-169 custom, 152, 581, 664-669, 672-676 data, 49, 61-63... property, 369 SourceSite property, 327 SourceSQLStatement property, 136 SourceTranslateChar property, 317 SourceUserName property, 327 sp stored procedures, 546-549 splitting packages, 378 records, 201, 206-209 subordinate dimensions, 95-97 spreadsheets, 74 SQL Namespace object model, 506, 542-545 SQL Profiler, 571 SQL Server, 36, 502, 598, 613 701 702 SQL statements SQL statements, 506 assigning, 366 modifying,... to custom transformations, 665-667 Analysis Services Processing task, 413, 415 Application object, 626 assignments, 372-374 Bulk Insert task, 281-286 Column object, 159-160 Connection object, 104 Catalog, 104-109, 112-114 Connection2 object, 104 Copy SQL Server Objects task, 317 Count, 624 CustomTask interface, 637-639 Data Mining Prediction Query task, 419 DataDrivenQueryTask object, 218 DataPumpTask... files, 151, 326 indexes, 311 logins, 311 meta data, 334 objects, 317, 510-511 permissions, 311 referential integrity constraints, 311 rules, 311 SQL Server Objects, 503, 513-514 stored procedures, 311 tables, 311 transformation logic, 578-581 triggers, 311 views, 311 MSMQ client, 392 multidimensional database schema, 74 multidimensional modeling, 80-82 multiphase data pump, 228-230, 243-245 On Batch Complete... 160-165, 201 data, 90 DataPumpTask object, 136 descriptions, 129-130 destination, 137-139 executing, 26 freestanding icon, 173-176 names, 129 objects, 350 Parallel Data Pump task, 260-263 performance, 126-127, 157-159, 582 programmatic identifier, 622 properties, 154-159, 217 703 704 Transform Data task records, 201 relational database source, 131-132 selecting, 269-270 source, 130-131, 236, 369 Transformation. .. modeling, 80-82 modifying connections, 121-122 data, 201, 503 Description property, 368 packages, 568 Parallel Data Pump task, 248 properties, 43, 54, 348, 541 SourceQuery property, 369 SQL statements, 300-301 Transform Data task, 236 MOLAP (Multidimensional OLAP), 76 monitoring constraints, 281-282 Send Mail task, 406 MonthLongName property, 171 moving data, 60, 311 databases, 310-311, 502-503 defaults, 311... Transform Data task, 129, 160-165 Visual C++, 243 W warehousing data, 37-38 Web clickstream data, 69 Web servers, 38 WebDrive, 326 WHERE clause, 584 Windows, 53 wizards, calling, 504-507 Workflow ActiveX Script, 494-496 Write File transformation, 151-152, 170-171 writing ActiveX scripts, 52, 152 code, 228, 239-242 queries, 294 task logs records, 358-359 X–Z XML (Extensible Markup Language), 40 data, 72-74,... storing, 440-441 Parallel Data Pump task, 254-257 phases, 234-235 Post Source Data Phase, 242 Pre Source phase, 236-237 PreValidateSchema method, 668-669 ProcessPhase method, 672-676 public variables, 531 Pump Complete Phase, 243 records, 208-209 rows, 352 sources, 184-187 SQL Namespace, 543-545 steps, 497-499 text files, 72 Transact -SQL Code, 549-552 transactions, 492-493 Transfer Databases task, 341-342 . files 685 Data Pump task, 661-662 Data Transform task, 47 Data Transformation Services, see DTS Data Transformation task, see Transform Data task databases. 408 SQL Namespace, 506 Transfer Objects task, 317-320 UnitializeMAPI, 408 Microsoft Access, 36 Microsoft Access 2000, 102 Microsoft Excel 2000, 102 Microsoft

Ngày đăng: 07/11/2013, 20:15

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan