我在SSIS包中运行Execute SQL Task语句。 “执行SQL任务”正在运行sql,并检查表中是否有1000行以上。如果它们的行数少于1000,我想使程序包失败。
如何在SQL语句内部强制失败?
最佳答案
AFAIK,SSIS中的任务因错误而失败。因此,如果您的Execute SQL Task中有这样的陈述:
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
您应该得到想要的结果。
关于ssis - 如何在Integration Services中手动使软件包失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/435651/