-- ============================================= -- create procedure with output parameters -- ============================================= -- creating the store procedure if exists (select ROUTINE_NAME from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME = N'' and ROUTINE_TYPE = N'PROCEDURE' drop procedure dbo. go /****************************************************************************** dbo. purpose : author : created : history : - - creation of the sproc ******************************************************************************/ create procedure dbo. <@param1, sysname, @p1> = , <@param2, sysname, @p2> = output, <@proc_cursor_name, , @proc_test_cursor> cursor varying output as -- declaration of local variables declare <@return_var, sysname, @return> int, <@error_var, sysname, @error> int -- initialisation of local variables set <@return_var, sysname, @return> = set <@error_var, sysname, @error> = -- body of sproc select @p2 = @p2 + @p1 set <@error_var, sysname, @error> = @@error set <@proc_cursor_name, , @proc_test_cursor> = cursor for open <@proc_cursor_name, , @proc_test_cursor> -- cleanup of sproc if <@error_var, int, @error> != 0 set <@return_var, int, @return> = <@error_var, int, @error> go