Callable Procedures > SQL Server Examples:
  
SQL Server Examples:
1. SQL Server example of a call from a Stored Procedure:
Add the following to the declaration section of the stored procedure:
DECLARE @v_result integer
Then add the call to the procedure:
EXEC Ws_Maintain_Indexes @p_sequence, @p_job_name, @p_task_name, @p_job_id, @p_task_id
, 'load_customer', NULL, NULL, 'DROP ALL', @v_result OUTPUT
Perhaps add a check of the result:
IF @v_result <> 1
BEGIN
SET @p_status =@v_result
SET @p_return_msg = 'Failed to maintain indexes.'
END
2. SQL Server example of a call from the command line using sqlcmd (all one line):
sqlcmd -S"SQL SERVER" -WslWarehouse -E -Q"DECLARE @RES integer;EXEC Ws_Maintain_Indexes 1,'Maintain Ind','Ind',0,0,'load_customer',NULL,NULL,'DROP ALL',@RES OUTPUT; SELECT @RES"
The following out is typical:
(1 rows affected)
-----------
1
(1 rows affected)
3. SQL Server example of a call from QAD SQL Admin
{Call Ws_Maintain_Indexes(1,'Maintain Ind','Ind',0,0,'load_customer',NULL,NULL,'DROP ALL',?)};