ASExecuteDDLTask.Source Property
Gets or sets the text of the DDL statement to be sent to the Analysis Services server.
Пространство имен: Microsoft.DataTransformationServices.Tasks.DTSProcessingTask
Сборка: Microsoft.SqlServer.ASTasks (in microsoft.sqlserver.astasks.dll)
Синтаксис
'Декларация
Public Property Source As String
public string Source { get; set; }
public:
property String^ Source {
String^ get ();
void set (String^ value);
}
/** @property */
public String get_Source ()
/** @property */
public void set_Source (String value)
public function get Source () : String
public function set Source (value : String)
Значение свойства
The text of the DDL statement to be sent to the Analysis Services server.
Замечания
This property works with the SourceType property. If the source type is a variable, and the variable is null, the String returned is empty. If the source type is a connection and there is an error retrieving the connection, the String returned is empty.
The DDL statement consists of an XML for Analysis (XMLA) statement that contains the XMLA Create, Alter, or Delete commands, in a format like the example that follows:
<Create xmlns="https://schemas.microsoft.com/analysisservices/2003/engine">
<ParentObject>
<DatabaseID>Adventure Works DW</DatabaseID>
</ParentObject>
<ObjectDefinition>
<Dimension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID>Dim Customer</ID>
<Name>Customer</Name>
<Annotations>
...
</Annotations>
<Source xsi:type="DataSourceViewBinding">
<DataSourceViewID>Adventure Works DW</DataSourceViewID>
</Source>
<Type>Customers</Type>
<Language>1033</Language>
<Collation>Latin1_General_CI_AS</Collation>
<UnknownMemberName>Unknown</UnknownMemberName>
<Translations>
...
</Translations>
<Attributes>
...
</Attributes>
...
</Dimension>
</ObjectDefinition>
</Create>
Пример
The following code sample creates, configures, and executes a new ASExecuteDDLTask that loads the DDL statement to execute from a file connection. The sample uses the Source property.
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.DataTransformationServices.Tasks.DTSProcessingTask;
class Module1
{
public static void Main()
{
Package pkg = new Package();
ConnectionManager asCM;
asCM = pkg.Connections.Add("MSOLAP90");
asCM.Name = "Analysis Services Connection Manager";
asCM.ConnectionString = "Data Source=<servername>;" +
"Initial Catalog=Adventure Works DW;Provider=MSOLAP.3;" +
"Integrated Security=SSPI;Impersonation Level=Impersonate;";
ConnectionManager cmdCM;
cmdCM = pkg.Connections.Add("FILE");
cmdCM.Name = "Command Source Connection Manager";
cmdCM.ConnectionString = "C:\\ddltest.txt";
Executable exe = pkg.Executables.Add("Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, " +
"Microsoft.SqlServer.ASTasks, Version=9.0.242.0, " +
"Culture=neutral, PublicKeyToken=89845dcd8080cc91");
TaskHost thTask = (TaskHost) exe;
{
thTask.Properties("ConnectionName").SetValue(thTask, "Analysis Services Connection Manager");
thTask.Properties("SourceType").SetValue(thTask, DDLSourceType.FileConnection);
thTask.Properties("Source").SetValue(thTask, "Command Source Connection Manager");
}
DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);
if (valResults==DTSExecResult.Success)
{
pkg.Execute();
}
}
}
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.DataTransformationServices.Tasks.DTSProcessingTask
Module Module1
Sub Main()
Dim pkg As New Package
Dim asCM As ConnectionManager
asCM = pkg.Connections.Add("MSOLAP90")
asCM.Name = "Analysis Services Connection Manager"
asCM.ConnectionString = "Data Source=<servername>;" & _
"Initial Catalog=Adventure Works DW;Provider=MSOLAP.3;" & _
"Integrated Security=SSPI;Impersonation Level=Impersonate;"
Dim cmdCM As ConnectionManager
cmdCM = pkg.Connections.Add("FILE")
cmdCM.Name = "Command Source Connection Manager"
cmdCM.ConnectionString = "C:\ddltest.txt"
Dim exe As Executable = pkg.Executables.Add( _
"Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, " & _
"Microsoft.SqlServer.ASTasks, Version=9.0.242.0, " & _
"Culture=neutral, PublicKeyToken=89845dcd8080cc91")
Dim thTask As TaskHost = CType(exe, TaskHost)
With thTask
.Properties("ConnectionName").SetValue(thTask, _
"Analysis Services Connection Manager")
.Properties("SourceType").SetValue(thTask, DDLSourceType.FileConnection)
.Properties("Source").SetValue(thTask, "Command Source Connection Manager")
End With
Dim valResults As DTSExecResult = pkg.Validate( _
pkg.Connections, pkg.Variables, Nothing, Nothing)
If valResults = DTSExecResult.Success Then
pkg.Execute()
End If
End Sub
End Module
Синхронизация потоков
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Платформы
Платформы разработки
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
Целевые платформы
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
См. также
Справочник
ASExecuteDDLTask Class
ASExecuteDDLTask Members
Microsoft.DataTransformationServices.Tasks.DTSProcessingTask Namespace