Knowledge Base > Automation Engine and Target Systems > Databases > Stored Procedures in MS SQL Server

Stored Procedures in MS SQL Server

The AE databaseA database is an organized collection of data including relevant data structures. agent can be used to process Stored Procedures for MS SQL.

RETURN

The statement RETURN can return a number. This return code can then be written to the job report (see example below). The name of the stored procedure is ANGTEST.

SQL_SET_STATEMENT_TERMINATOR TERM='!';
DECLARE @result int;
EXEC @result = ANGTEST;
select @result;!

A separator other than the semicolon is automatically used because this character has already been used within the statement.

The job ends normally regardless of its return code. If you intend to change a job's end status, you can read the corresponding value in the job report and react to it using :MODIFY_STATE.

PRINT

The statement PRINT facilitates the output of messages to a user (example: DBCC CHECKDB). These messages are also written to the job report. Job execution continues as usual.

RAISE ERROR

Causes the job to be aborted. The error message is written to the activation report.

 

See also:

Form tab
Process tab

PREP_PROCESS_REPORT