To implement and test a Data Transformation Services (DTS) custom transformation, you need to:
To install the header and library files, you must do a custom installation of SQL Server 2000 or the SQL Server 2000 client tools on the computer on which you develop the custom transformation.
To install header and library files during a custom installation
You can add code to a standard Active Template Library (ATL) template or use the custom transformation template included with SQL Server 2000 to build the transformation framework. For more information, see Building a Custom Transformation from a Standard ATL Template and Using the ATL Custom Transformation Template.
Your custom transformation may require properties that are not supplied by the custom transformation framework.
To add properties to a custom transformation
This procedure adds shells for the get_property and put_property functions to your project. You must provide the code to implement them.
Before you attempt to compile any of the framework files, you need to configure Visual C++ to look for SQL Server 2000 header and library files.
To configure Visual C++ to build the project
File type | Path |
---|---|
Executable files | C:\Program Files\Microsoft SQL Server\80\Tools\Binn |
Include Files | C:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Include |
Library files | C:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Lib |
Source files | C:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Include |
This only needs to be done once after installing SQL Server 2000. The paths will be different if SQL Server 2000 components were installed to other than the default locations.
You also need to define the preprocessor symbol _ATL_NO_UUIDOF.
To enter preprocessor symbols
You need to add code for the logic specific to your transformation.
All transformations need IDTSDataPumpTransform::ValidateSchema, plus either IDTSDataPumpTransform::Execute or IDTSDataPumpTransform2::ProcessPhase, in order to be functional beyond a placeholder that returns NOERROR. If the transformation is to run in DTS Designer, you also need to provide IDTSDataPumpTransform2::PreValidateSchema. For more information, see IDTSDataPumpTransform Interface and IDTSDataPumpTransform2 Interface.
For more information about coding transformation logic, see DTS Custom Transformation Example: Copy One Column and DTS Custom Transformation Example: Format Names.
When you build the custom transformation project in Visual C++, it registers the transformation as the final step of the build process. If you have enabled DTS component caching, you will need to refresh the cache or DTS Designer will not be able to see the transformation component.
To refresh the cache
If you want to remove a custom transformation from your computer, you must unregister it before deleting the component .dll file.
To unregister a custom transformation
You can debug a custom transformation by running it from DTS Designer or from a DTS package program (for example, one implemented in Microsoft Visual Basic®). Using DTS Designer may give you more testing options, as IDTSDataPumpTransform2::PreValidateSchema is called and a custom user interface can be displayed. In either case, you must specify the executable name and path, along with any parameters the executable requires, on the Debug tab of the Project Settings dialog box.
If you use DTS Designer, you typically enter C:\WINNT\system32\mmc.exe in the Executable for debug session box and /s "c:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC" in the Program arguments box.
To determine the correct debugging settings for your computer
When a transformation commits an access violation or other fatal error, the data pump terminates it and reports that the task using the transformation failed. For example, when an access violation occurs, the message "Access is denied" is displayed. It is recommended you place a breakpoint at the entry to IDTSDataPumpTransform::OnTransformComplete or the OnPumpComplete code in IDTSDataPumpTransform2::ProcessPhase. If this breakpoint is reached unexpectedly before all rows are processed, a likely cause is a transformation fatal error.