gpt4 book ai didi

ssis - 使用 BIML 添加脚本任务

转载 作者:行者123 更新时间:2023-12-04 17:22:02 25 4
gpt4 key购买 nike

我正在尝试通过 BIML 将脚本任务添加到我的 SSIS 包中。这是怎么做的?我添加了以下内容,但 ScriptTaskProjectName 无法解析。

        <Script Name="Script Task" LoggingMode="Enabled">  
<ScriptTaskProjectReference ScriptTaskProjectName="MyScript" />
</Script>

最佳答案

快速而肮脏的答案是使用 bimlscript.com 上的现有示例。

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="Package2" ConstraintMode="Parallel" ProtectionLevel="EncryptSensitiveWithUserKey">
<Tasks>
<Script ProjectCoreName="ST_232fecafb70a4e8a904cc21f8870eed0" Name="ScriptTask 1">
<ScriptTaskProject>
<ScriptTaskProject ProjectCoreName="ST_c41ad4bf47544c49ad46f4440163feae" Name="TaskScriptProject1">
<AssemblyReferences>
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ManagedDTS.dll" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ScriptTask.dll" />
<AssemblyReference AssemblyPath="System.dll" />
<AssemblyReference AssemblyPath="System.AddIn.dll" />
<AssemblyReference AssemblyPath="System.Data.dll" />
<AssemblyReference AssemblyPath="System.Windows.Forms.dll" />
<AssemblyReference AssemblyPath="System.Xml.dll" />
</AssemblyReferences>
<Files>
<File Path="AssemblyInfo.cs">
using System.Reflection;
using System.Runtime.CompilerServices;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("ST_c41ad4bf47544c49ad46f4440163feae.csproj")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Varigence")]
[assembly: AssemblyProduct("ST_c41ad4bf47544c49ad46f4440163feae.csproj")]
[assembly: AssemblyCopyright("Copyright @ Varigence 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.0.*")]
</File>
<File Path="ScriptMain.cs">
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;

// if SSIS2012, use the following line:
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]

// if earlier version, use the next line instead of the above line:
// [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};

public void Main()
{
Dts.TaskResult = (int)ScriptResults.Success;
}
}
</File>
</Files>
</ScriptTaskProject>
</ScriptTaskProject>
</Script>
</Tasks>
</Package>
</Packages>
</Biml>

这会生成一个带有单个脚本任务的 SSIS 包。

enter image description here

来自评论

在 SSIS 2017 中,您需要替换 Assembly-Refs:
  • 系统
  • 系统数据
  • System.Windows.Forms
  • System.Xml
  • Microsoft.SqlServer.TxScript
  • Microsoft.SqlServer.DTSRuntimeWrap
  • Microsoft.SqlServer.DTSPipelineWrap
  • Microsoft.SqlServer.PipelineHost
  • 关于ssis - 使用 BIML 添加脚本任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21440993/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com