Variable Variable Variable Class


Represents a variable on a package, task, or container. This class cannot be inherited.

public ref class Variable sealed : Microsoft::SqlServer::Dts::Runtime::DtsObject, IDisposable, Microsoft::SqlServer::Dts::Runtime::IDTSExecutionPath, Microsoft::SqlServer::Dts::Runtime::IDTSName, Microsoft::SqlServer::Dts::Runtime::IDTSPackagePath, Microsoft::SqlServer::Dts::Runtime::IDTSPersist, Microsoft::SqlServer::Dts::Runtime::IDTSPropertiesProvider, System::ComponentModel::IComponent
public sealed class Variable : Microsoft.SqlServer.Dts.Runtime.DtsObject, IDisposable, Microsoft.SqlServer.Dts.Runtime.IDTSExecutionPath, Microsoft.SqlServer.Dts.Runtime.IDTSName, Microsoft.SqlServer.Dts.Runtime.IDTSPackagePath, Microsoft.SqlServer.Dts.Runtime.IDTSPersist, Microsoft.SqlServer.Dts.Runtime.IDTSPropertiesProvider, System.ComponentModel.IComponent
Public NotInheritable Class Variable
Inherits DtsObject
Implements IComponent, IDisposable, IDTSExecutionPath, IDTSName, IDTSPackagePath, IDTSPersist, IDTSPropertiesProvider


Variables are grouped into namespaces for disambiguation. The System namespace is created automatically for every package and contains read-only properties. The User namespace contains custom properties that you can add. You can also create a namespace of your choosing to which to add variables. This class inherits from several classes and interfaces, including two from the Visual Studio .NET Framework:


CreationName CreationName CreationName

Gets the string that the runtime engine gives when it creates an instance of the Variable object and adds the object to the Variables collection. This property is read-only.

DataType DataType DataType

Gets a TypeCode enumeration that describes the data type of the variable. This property is read-only.

Description Description Description

Gets or sets the description for the variable.

EvaluateAsExpression EvaluateAsExpression EvaluateAsExpression

Gets or sets a Boolean that indicates whether the variable contains an expression.

Expression Expression Expression

Gets or sets the expression contained in a variable.


Gets the GUID assigned to the variable. This field is read-only.

IncludeInDebugDump IncludeInDebugDump IncludeInDebugDump

Gets or sets a value that specifies whether the variable value for a user-defined variable or a system variable is included in the debug dump files.

Name Name Name

Gets or sets the name of the variable.

Namespace Namespace Namespace

Gets or sets the namespace that the variable belongs to.

Parent Parent Parent

Gets the parent container of the Variable instance.

Properties Properties Properties

Gets a collection of DtsProperty objects. This property is read-only.

QualifiedName QualifiedName QualifiedName

Gets the fully qualified name of the variable, including the namespace. This property is read-only.

RaiseChangedEvent RaiseChangedEvent RaiseChangedEvent

Gets or sets a Boolean that indicates if the variable has been flagged to raise the OnVariableValueChanged(DtsContainer, Variable, Boolean) event when the value of the variable changes.

ReadOnly ReadOnly ReadOnly

Gets or sets a Boolean that indicates that the variable is read-only and cannot have its value modified.

Site Site Site

Gets or sets the site of the variable.

SystemVariable SystemVariable SystemVariable

Gets a Boolean that indicates whether the variable is a system variable. This property is read-only.

Value Value Value

Gets or sets the value assigned to the variable.


Dispose() Dispose() Dispose()

This method is inherited from the IDisposable.Dispose method, which is a mechanism to explicitly tell an object to perform cleanup.

Equals(Object) Equals(Object) Equals(Object)

Determines whether two object instances are equal.

(Inherited from DtsObject)
GetExecutionPath() GetExecutionPath() GetExecutionPath()

Returns the execution path of the current Variable object.

GetExpression(String) GetExpression(String) GetExpression(String)

The GetExpression(String) method is not supported on Variable objects. Use the EvaluateAsExpression property instead.

GetHashCode() GetHashCode() GetHashCode()

Returns the hash code for this instance.

(Inherited from DtsObject)
GetPackagePath() GetPackagePath() GetPackagePath()

Returns the path of the package that the variable belongs to.

GetSensitiveValue() GetSensitiveValue() GetSensitiveValue()

Returns the sensitive variable value.

LoadFromXML(XmlNode, IDTSEvents) LoadFromXML(XmlNode, IDTSEvents) LoadFromXML(XmlNode, IDTSEvents)

This method is not callable by your application code. Loads a package saved as .xml, use the LoadPackage(String, IDTSEvents) method.

SaveToXML(XmlDocument, XmlNode, IDTSEvents) SaveToXML(XmlDocument, XmlNode, IDTSEvents) SaveToXML(XmlDocument, XmlNode, IDTSEvents)

This method is not callable by your application code. Saves a package as .xml, use the SaveToXml(String, Package, IDTSEvents) method.

SetExpression(String, String) SetExpression(String, String) SetExpression(String, String)

The SetExpression(String, String) method is not supported on Variable objects. Use the EvaluateAsExpression property instead.


Disposed Disposed Disposed

Adds an event handler to listen to the Disposed event on the variable.

Applies to