Stored Procedures in MS SQL Server
The AE database agent can be used to process Stored Procedures for MS SQL.
This page includes the following:
RETURN
The statement RETURN can return a number. This return code can then be written to the job report. The name of the stored procedure is ANGTEST.
Example
SQL_SET_STATEMENT_TERMINATOR TERM='!';
DECLARE @result int;
EXEC @result = ANGTEST;
select @result;!
Notes:
- 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 .
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: