SQL Server Agent - stored procedure
From: Jay Hawkinson (Jay.Hawkinson_at_beldencdt.com)
Date: 09/09/04
- Next message: Aaron [SQL Server MVP]: "Re: using "substring" & "top" keyword in TSQL"
- Previous message: anonymous_at_discussions.microsoft.com: "Re: Maximum number of fields for a record"
- Next in thread: Alejandro Mesa: "RE: SQL Server Agent - stored procedure"
- Reply: Alejandro Mesa: "RE: SQL Server Agent - stored procedure"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 9 Sep 2004 07:28:20 -0700
Good morning.
I have a stored procedure which I run from SQL Server
Agent. This stored procedure, basically, INSERTS a row
into a database, and if a duplicate key exists, it puts it
in a DUPS table.
The problem is that though Query Analyzer will continue
when it hits an error (and allows me to do my error
processing), SQL Server Agent crashes out. Is there anyway
to have SQL Server Agent behave the same way? Is there a
threshold of errors count?
Code snippet wise it looks like this:
INSERT INTO BELDEN_CDB.IWORK.BFGTCKT VALUES (
@bfgtckt ,
@bfgitem ,
@bfgqty ,
@bfgloc ,
@bfgload ,
@bfgused ,
@bfglot)
SET @sqlcode = @@error
IF @sqlcode in (2601, 2607, 2627)
BEGIN
SET @dups = @dups + 1
INSERT INTO BELDEN_CDB.IWORK.BFG_Dups VALUES (
@bfgtckt ,
@bfgitem ,
@bfgqty ,
@bfgloc ,
@logged )
END
Jay Hawkinson
- Next message: Aaron [SQL Server MVP]: "Re: using "substring" & "top" keyword in TSQL"
- Previous message: anonymous_at_discussions.microsoft.com: "Re: Maximum number of fields for a record"
- Next in thread: Alejandro Mesa: "RE: SQL Server Agent - stored procedure"
- Reply: Alejandro Mesa: "RE: SQL Server Agent - stored procedure"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|