SAVE_STORED_PROCEDURE_DATA function sample
Review a sample procedure with the SAVE_STORED_PROCEDURE_DATA function.
Given below is a stored procedure in MS SQL Server:
CREATE procedure ExtractTotal(@RecType varchar(20), @Cycle int)as
begin
select t.*, GETDATE() dt, 'abc,def' ss from TCFTotals_Rec_Type_Total t
where Rec_Type_ = @RecType and CycleValue = @Cycle
end
In the rule procedure, create a database data source pointing to the database where the stored procedure resides. Create the rule procedure with a SAVE_STORED_PROCEDURE_DATA command similar to this:
SAVE_STORED_PROCEDURE_DATA("MSSQL_DB", "exec ExtractTota 'VAPS', 20150301", "C://temp//sp_data.csv")Where:
Run the rule procedure, making sure that it returns "OK," and that the output file C://temp//sp_data.csv exists and contains the record set returned by stored procedure.