如何在 Integration Services 中手动使包失败? [英] How can I manually fail a package in Integration Services?

查看:29
本文介绍了如何在 Integration Services 中手动使包失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的 SSIS 包中运行一个执行 SQL 任务语句.执行 SQL 任务正在运行 sql 并检查表是否超过 1000 行.如果它们少于 1000 行,我想使包失败.

I am running an Execute SQL Task statement in my SSIS package. The Execute SQL Task is running sql and checking that the tables have more than 1000 rows. If they have less than 1000 rows, I want to fail the package.

如何在 SQL 语句中强制失败?

How do I force a fail inside of a SQL statement?

推荐答案

AFAIK,SSIS 中的任务因错误而失败.因此,如果您的执行 SQL 任务中有这样的语句:

AFAIK, tasks in SSIS fail on error. So if your Execute SQL Task has a statment like so in it:

declare @count int
select @count = select count(*) from my_table
if @count < 1000
begin
    raiserror('Too few rows in my_table',16,1)
end
else
begin
    -- Process your table here
end

你应该得到你想要的结果.

You should get the results you want.

这篇关于如何在 Integration Services 中手动使包失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆