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.
| Author |
Topic |
|
snarayan
Starting Member
10 Posts |
Posted - 2004-06-17 : 18:37:11
|
| HiRunning a SQL job that imports records from another SQL server and processes the records. The Job runs every 2 minutes.Once a while the processing part fails, error message is 2627 - Primary Key constraint. This is not a problem as I can handle this error ieInsert into mytable Select * from sourceSelect @ret = @@ErrorIf @ret = 2627 Begin -- do error handlingEndWhen I execute the Stored Procedure from SQL Query Analyser, the error is reported but the stored Procedure is not terminated and error handling code is executed.But when the stored procedure is executed as part of a SQL job, the job terminates and error handling code is not executed.How can I catch the SQL error within the job ie stop the job from terminating?ThanksSanjay |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-06-17 : 23:49:14
|
| You could move this into a DTS package. On failure go one direction. On success go another. That would be the easiest solution. You could then just schedule the package.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|