- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过存储过程执行 SSIS 包。
仅当参数被硬编码时(如代码的第一个版本中所述),我才能成功执行该存储过程
代码的第一个版本:
SELECT @Cmd = 'DTexec /F "C:\ssis\tool\package1.dtsx"
/SET "\Package.Variables[User::ConfigurationName].Properties[Value]";"Report1"
/SET "\Package.Variables[User::Country].Properties[Value]";"USA"
/SET "\Package.Variables[User::OrgDepartment_Team].Properties[Value]";"USA"
/SET "\Package.Variables[User::Subfix].Properties[Value]";"20190503"
/SET "\Package.Variables[User::TeamName].Properties[Value]";"Team1"'
在数据库中创建一条记录
但是下面的代码不起作用(我传递相同的参数值)
代码的第二个版本:
SELECT @Cmd = 'DTexec /F "C:\ssis\tool\package1.dtsx"
/SET "\Package.Variables[User::ConfigurationName].Properties[Value]";"' + @ConfigurationName +
'" /SET "\Package.Variables[User::Country].Properties[Value]";"' + @Country +
'" /SET "\Package.Variables[User::OrgDepartment_Team].Properties[Value]";"' + @OrgDepartment_Team +
'" /SET "\Package.Variables[User::Subfix].Properties[Value]";"' + @Subfix +
'" /SET "\Package.Variables[User::TeamName].Properties[Value]";"' + @TeamName + '"'
没有错误,但数据库中也没有创建记录。
DTExec: The package execution returned DTSER_SUCCESS (0).
如果有任何帮助,我将不胜感激:)
最佳答案
看起来您正在使用有效的语法,但我将提供一些可能有助于解决问题的建议:
检查命令中使用的变量是否不包含NULL值,可能会导致连接后的字符串值为NULL
,可以使用ISNULL()
解决问题。
SELECT @ConfigurationName = ISNULL(@ConfigurationName,'') ,
@Country = ISNULL(@Country ,'') ,
@OrgDepartment_Team = ISNULL(@OrgDepartment_Team,'') ,
@Subfix = ISNULL(@Subfix ,'') ,
@TeamName = ISNULL(@TeamName,'')
我更喜欢在变量中包含引号而不是主字符串。您可以使用 QUOTENAME()
函数来实现:
SELECT @ConfigurationName = QUOTENAME(ISNULL(@ConfigurationName,''),'"') ,
@Country = QUOTENAME(ISNULL(@Country ,''),'"') ,
@OrgDepartment_Team = QUOTENAME(ISNULL(@OrgDepartment_Team,''),'"') ,
@Subfix = QUOTENAME(ISNULL(@Subfix ,''),'"') ,
@TeamName = QUOTENAME(ISNULL(@TeamName,''),'"')
SELECT @Cmd = 'DTexec /F "C:\ssis\tool\package1.dtsx"
/SET "\Package.Variables[User::ConfigurationName].Properties[Value]";' + @ConfigurationName +
' /SET "\Package.Variables[User::Country].Properties[Value]";' + @Country +
' /SET "\Package.Variables[User::OrgDepartment_Team].Properties[Value]";' + @OrgDepartment_Team +
' /SET "\Package.Variables[User::Subfix].Properties[Value]";' + @Subfix +
' /SET "\Package.Variables[User::TeamName].Properties[Value]";' + @TeamName
您可以通过在命令中添加 /Rep EWIP
关键字来读取整个包日志:
SELECT @Cmd = 'DTexec /F "C:\ssis\tool\package1.dtsx" /Rep EWIP '
/Rep[orting] level [;event_guid_or_name[;event_guid_or_name[...]]: (Optional). Specifies what types of messages to report. The available reporting options for level are as follows:
N No reporting.
E Errors are reported.
W Warnings are reported.
I Informational messages are reported.
C Custom events are reported.
D Data Flow task events are reported.
P Progress is reported.
V Verbose reporting
引用文献
关于sql - 如何从 SQL Server 存储过程执行 SSIS 包并传递参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56029228/
我有一些自定义控制流和数据流任务未显示在 SSIS 工具箱中。当我在 SSDT 中打开包含自定义任务的包时,加载该包时出现几个错误。 加载 MyModuleTemplate1.dtsx 时出错:由于错
我有一个现有的 SSIS 包 (load1),它将数据从一台服务器 (srv1) 加载到我的服务器 (srv2)。在我可以运行 load1 之前,还有 2 个其他负载需要在 srv1 上运行,然后 l
我有点困惑 async方法是否适用于 SSIS 作业。脚本任务项创建一个面向 .NET Framework 4.5 的 Visual Studio 项目,输出类型为类库。 如果我制作主要方法 publ
有没有一种方法可以在 SSIS 执行期间动态创建目标文件夹而不使用脚本任务,例如。我有代码 123、133、143,如果不存在,我想在下面创建一个文件夹位置 D:\Outbox\ACI\123 D:\
我需要执行 29 个 ssis 包。所以计划创建一个主包来执行所有这些包。我不知道如何实现这一点。能否请您简要解释一下。提前致谢 ! 最佳答案 这篇文章很好地概括了主包的功能,它基本上是一个在控制流中
我有一个像这种格式的字符串。就我而言,我只需要从字符串大小写中提取字符 1)12AB 2)SD12 3)1WE4 输出 1)AB 2)SD 3)WE 我只需要提取字符。我在 SSIS 包的派生列中使用
使用: Windows 7 企业版; Visual Studio Pro 2017 (15.3.5);固态硬盘 15.1 无法让数据查看器在我的 SSIS 包上弹出。我确实做了一些 Google-fu
我可以使用什么模式/通配符来分别获取以下两个文件?目前,我正在使用此模式 CRM#ContractsBillingAccount*.csv 但两个文件名都符合此模式。如何避免? CRM#Contrac
是否可以在脚本任务中将发生的异常重定向到另一个表/日志?如果是这样,该怎么做? 最佳答案 您可以在脚本任务中执行在 vb.net 或 C# 中可以执行的任何操作。但是如果你在一个脚本任务中做了这么多,
我使用 CSV 中的以下内容来测试 SCD。我认为它会识别 LocationID 并在必要时更新记录。但它没有。它只插入新记录。 我正在使用带有 Win 身份验证的 Visual Studio 201
我对 SSIS 事务隔离级别的问题很少。 考虑一个场景:我有一个执行 SQL 任务,它在表 A 中插入数据。这个任务指向一个数据流任务,它读取以前插入到 A 上的数据。我已经启动了分布式事务,如果我在
你好 我正在创建一个需要按指定顺序执行以下操作的 ssis 包: 1:处理一些数据 2:将该数据移动到其他一些表 3:获取一些数据并将其推送到纯文本文件中。 我为这些创建了 3 个存储过程,我为 1
使用SQLServer 2012 Enterprise,在“控制流”选项卡中单击鼠标右键时,在SSIS中看不到“程序包配置向导”。我可以看到所有其他项目(日志,数字签名...)。 以下是有关我的安装的
我有一个 Foreach 容器,其中有一个 执行进程任务 。我有很多 Console.WriteLine() 语句。 图像中突出显示的 3 个图像可用于从 .exe 获取输出。 我在包中声明了一个变量
SSIS 非常擅长处理所有记录都相同的平面文件,但当存在一点复杂性时就不太好了。 我想导入一个与此类似的文件 - Customer: 2344 Name: John Smith Item
当我在 SSIS 包 (ProtectionLevel) 上设置权限并输入 PackagePassword 时,当我在计算机上打开包时,它不会提示我输入密码。 我做错了吗? 最佳答案 你可能没有做错什
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我致力于创建 biml。从中生成 ssis 包。构建 SSIS 项目,然后在服务器上部署 ispac 文件。 但是这些所有手动步骤都可以自动化吗? 我可以使用命令行从 biml 生成 ssis 吗?除
我已经创建了一个 SSIS 包。如果包失败,我需要将事务应用于此包以进行回滚。我发现的是一个属性“TransactionOption”,它应该被赋予“Required”。我对吗 ?并且我已将包的 Tr
我在 Visual Studio 2015 中向 SSIS 添加自定义 SSIS 组件时遇到问题。 我的系统是:Windows 8.1 64 位 Visual Studio 社区 2015 版14.0
我是一名优秀的程序员,十分优秀!