FIX: Objects Created and Stored in DTS Global Variables Released Prematurely

Article translations Article translations
Article ID: 245795 - View products that this article applies to.
This article was previously published under Q245795
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 55241 (SQLBUG_70)
Expand all | Collapse all

SYMPTOMS

When using a Data Transformation Services (DTS) package global variable to reference an object created in an ActiveX Script task or transformation, the object may be released at the end of the ActiveX Script that creates the object. This makes the object unavailable to subsequent tasks that attempt to access it through the global variable reference.

The problem is only seen when the object is added to the global variables collection using the AddGlobalVariable method of the collection.

In the following example the file system object created in the code would be released at the end of the ActiveX Script task, even though a global variable is referencing the object.
Function Main()
dim fso
	'The global variable is empty after this task completes.
	set fso = CreateObject("Scripting.FileSystemObject")
	DTSGlobalVariables.AddGlobalVariable "fileobject, fso
	Main = DTSTaskExecResult_Success
End Function
				
Instead, use the following code, which works:
Function Main()
dim fso
        'The global variable still contains a File System Object 
        'after this task completes.
	set fso = CreateObject("Scripting.FileSystemObject")
	set DTSGlobalVariables("fileobject").value = fso
	Main = DTSTaskExecResult_Success
End Function
				

CAUSE

This is caused by a problem with the reference count not being properly incremented for the object when it is stored as a global variable.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.

Properties

Article ID: 245795 - Last Review: October 22, 2013 - Revision: 2.1
APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbbug kbfix KB245795

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com