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 2005 Forums
 Transact-SQL (2005)
 How to keep on excute regardless an error?

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-11-21 : 09:45:53
I use code below to run a job:

if something...

begin

step 1
step 2
...
step 3

end

The problem is if any step has an error, entire job will stop running.
How to code to make job keep on running regardless an error within any step?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-11-21 : 09:48:37
well the exiting of the connection depends on the error severity.
you could try try...catch blocks


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

Pace
Constraint Violating Yak Guru

264 Posts

Posted - 2007-11-21 : 10:24:29
Or make the steps as a sql agent job and set the options for "on failure" of a step to continue to next step? Would that work?

... transactions...

"Impossible is Nothing"
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-11-21 : 10:52:06
Yes, how to code?
In VBA, code like

"On Error Resume Next"
Go to Top of Page
   

- Advertisement -