Home All Groups Group Topic Archive Search About

Job Outcome Constants (SQLDMO_JOBOUTCOME_TYPE)

Author
22 Jun 2006 4:21 PM
marcmc
How can i write a simple procedure as below, call it from a job, and because
@m = 2 it will fail the job step and so show me the red x beside the job name
in ent mgr?

create procedure marc1 as

declare @m int
set @m = 2
if @m = 1
begin
    print '2'
end
else
begin
    print '2'
    return -1
end

Author
22 Jun 2006 4:38 PM
Tracy McKibben
marcmc wrote:
Show quote
> How can i write a simple procedure as below, call it from a job, and because
> @m = 2 it will fail the job step and so show me the red x beside the job name
> in ent mgr?
>
> create procedure marc1 as
>
> declare @m int
> set @m = 2
> if @m = 1
> begin
>     print '2'
> end
> else
> begin
>     print '2'
>     return -1
> end

Use RAISERROR:

e.g. RAISERROR('My error message', 16, 1)

AddThis Social Bookmark Button