Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I manually fail a package in Integration Services?

Tags:

ssis

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.

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

like image 966
Brian Bolton Avatar asked Jan 12 '09 14:01

Brian Bolton


People also ask

Why is my SSIS package failing?

Reasons that the package may have failed are as follows: The user account that is used to run the package under SQL Server Agent differs from the original package author. The user account does not have the required permissions to make connections or to access resources outside the SSIS package.


1 Answers

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.

like image 104
Harper Shelby Avatar answered Sep 22 '22 02:09

Harper Shelby