Microsoft KB Archive/815126

= BUG: Renaming tasks or steps by using the DTS Object model results in a non-editable package =

Article ID: 815126

Article Last Modified on 9/29/2004

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



BUG #: 364231 (SHILOH_BUGS)



SYMPTOMS
If you rename tasks or steps for a Data Transformation Services (DTS) package by using the DTS Object model, you will have a non-editable package.

For example, if a default ExecuteSQLTask step name is DTSStep_DTSExecuteSQLTask_1, and you rename it to DTSStep_MyExecuteSQLTask by using the DTS object model, when you double-click the new name in DTS Designer, you receive the following error message:

Package Error:

Error Source: Microsoft Data Transformation Services (DTS) Package

Error Description: Step 'DTSStep_DTSExecuteSQLTask_1' was not found.



CAUSE
The problem is that DTS Designer maintains a reference to the task or step name in the layout data structures. This reference is not being updated when the task or step name is changed by the object model. The problem is that the DTS object model is not aware of the layout and the designer. Layout is built on top of the DTS Object Model. The task or step does not know if it is being hosted in the designer or a user-built application when its name is changed. As long as you use the designer to make changes, everything works because the designer knows about the object model. However, as soon as you move to the script to make changes, the consequences for layout are not captured. This is the same problem as &quot;why do I lose my layout when I save a package programatically?&quot; You lose your layout because the Object Model does not know that the layout exists.



WORKAROUND
To work around this behavior, you can use the DTS Designer or the script.

Use the DTS Designer
To rename the steps for a DTS package by using the DTS Designer, follow these steps:
 * 1) Open the DTS package in the DTS Designer.
 * 2) On the Package menu, click Disconnected Edit. The Edit All Package Properties window opens.
 * 3) In the left-pane of the Edit All Package Properties window, expand Steps.
 * 4) Under Steps, click to select a step.
 * 5) In the right-pane of the Edit All Package Properties window, locate and then double-click the Name property. The Edit Property dialog box opens.
 * 6) Type a new name in the Value box, and then click OK.
 * 7) Use steps 4-6 to rename any step.
 * 8) In the Edit All Package Properties window, click Close.

Note You can only use the DTS Designer to rename a step for a DTS package. You cannot use the DTS Designer to rename a task for a DTS package.

Use the script
To rename the steps for a DTS package by using the script, follow these steps:
 * 1) Rename the steps by running the script, and then save the package to Microsoft Visual Basic.
 * 2) Comment the package execute invocation (EXECUTE), in the Visual Basic code.
 * 3) Remove the comment for the package save invocation (SAVETOSQLSERVER), in the Visual Basic code.
 * 4) Compile, and then run the resulting Visual Basic code to create a new package that is saved with steps that are named correctly and that does not have a layout.

The next time the new package is loaded in the Designer, it will create a default layout that matches the new step names. Note This workaround works well if you only rename the steps one time.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.

