Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Raiseerror in a DTS 'Execute SQL Task' does not work, WHY ?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-12-12 : 07:31:14
Kay writes "Hello,

I have SQL Server 2000.

I created a new dts package which contains 2 'SQL Task'. In the first 'SQL Task' I count the number of records in a particular view and if the count is > 0 I don't want to execute the next Sql Task in the package. In the first SQL Task when the count is > 0 I raise an error, however when I execute this task, it always gives me "Successfully executed step" even when there are records in the view, I thought the step would fail.
The following SQL is in SQL Task 1

if (select count(*) from diamond.dbo.v_RiskType) > 0 RAISERROR ('New Risk types have been added in Diamond',10,1)

I have added a workflow between task 1 and 2 so that 2 only executes on successful execution of task 1 and on failure of task 1 I have a send Mail task.

May be I am not implementing it correctly but if anyone can let me know how to stop the execution of the second task when the count is > 0 in the first task and I will also need to send an email, I would be very grateful.

Thanks,
Kay"

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-12 : 08:03:10
Try to set the severity in RAISERROR to 11 or higher.
Also take a look at this:
[url]http://support.microsoft.com/kb/815115[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-12-12 : 09:15:22
if you wish to abort the execution after the raiserror use severity 18



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -