我正在编写一个应用程序,它将使用Microsoft.SqlServer.ManagedDTS v 11.0程序集执行SSIS 2012程序包.我正在尝试执行的程序包是从SSDT-2012设计并成功执行的,并且具有处理无法正确传输的行的脚本组件.
当我尝试运行我的应用程序时,我收到每个脚本组件的错误消息:
SSIS.Pipeline:要在SQL Server数据工具之外运行SSIS包,必须安装Integration Services或更高版本的[脚本组件名称].
配置:使用以下app.config文件在Windows上构建x86应用程序:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Run Code Online (Sandbox Code Playgroud)
唯一相关的代码是:
using System;
using System.Data;
using System.Data.Common;
using System.IO;
using Microsoft.SqlServer.Dts.Runtime;
class MyApp
{
public void ExecutePackage()
{
//Assume I have all the variables I need like packageFile, packageName,
//srcConnectionString, destConnectionString and eventListener etc.
Package pkg;
Application app;
DTSExecResults pkgResults;
app = new Application();
pkg = app.LoadPackage(packageFile, eventListener);
pkg.Variables["SrcConnectionString"].Value = srcConnectionString;
pkg.Variables["DestConnectionString"].Value = destConnectionString;
if (null != srcAssembly …Run Code Online (Sandbox Code Playgroud) 假设我们有一个叫做表StudentAccount的列SID(学生证)和AmountOwing。我们不能从系统中删除帐户,除非学生的帐户上没有任何欠款。(即AmountOwing = $0.00)。
例如,该表可能如下所示:
SID | Amount Owing
-------+--------------
32415 | $30.00
39872 | $0.00
35135 | $3200.00
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我们只能删除第 2 行。
有没有办法使用有效的 MS SQL Server 2012 SQL 语法对表强制执行此约束(以便未受过教育的用户不会意外删除非空帐户)?