Multiple runs of same stored procedure

I am an SSIS newbie so please excuse how little I know.
We have a manual job that I would like to automate in SSIS.
We run the same stored procedure six times with different parameters. Each run creates a csv file that we load into excel and then mail the attachments to the user. Can SSIS run the SP, and in a send mail task, send the six outputs?

You seem to imply that your stored proc is also creating the CSV with data. Usually I'd just let the stored proc populate a staging table with the data and let SSIS tasks to handle the export to CSV and the email part.
You can use an SSIS Execute SQL Task to run the stored proc with parameters. Then use an SSIS Data Flow Task (DFT) to export data to a CSV and use Send Mail Task (SMT) to send the CSV as an attachment. The path to the CSV file needs to
be in an SSIS variable. This variable can be populated via a config file, parameters or expression. The destination File Connection and the SMT will use this variable to set their File Path and Attachment properties respectively.
- Aalamjeet Rangi | (Blog)

Similar Messages

  • Retruring Multiple rows from a Stored Procedure

    The Oracle JDBC documentation shows how to return a cursor pointer through the parameter list of a stored procedure allowing a Java program to use the cursor like a normal result set. I've tried it (using the thin driver) and it works fine - however, I'm having trouble getting this to work running the program under a Weblogic server (using their own JDBC implementation). So, I have two questions:
    1) Has anyone had this problem before and solved it ??
    2) Are there any other techniques for getting multiple rows back from the database without having to fire "raw" sql at it ?

    Hi
    You could return not resultset but array, for example:
    PACKAGE TEST:
    type string_table is table of varchar2(80)
    index by binary_integer;
    function get_something (
    something1 out string_table,
    arraylength in number
    ) return number;
    PACKAGE'S BODY:
    function get_something (
    something1 out string_table,
    arraylength in number /** length of the array **/
    ) return number as
    cursor C is
    select something1, ...
    from test_table;
    pos number := 1;
    begin
    for position in C loop
    exit when (pos > arraylength);
    something1(pos) := position.something1;
    pos := pos + 1;
    end loop;
    return (pos - 1);
    end;
    Of course in this example you need to know length of your array
    (arraylength parameter), but you can avoid such problem, for
    example, by using DBMS_SQL package (or dynamic SQL feature in
    the Oracle8i).
    Andrew
    Mladen Gogala (guest) wrote:
    : Phil Hildebrand (guest) wrote:
    : : Is there a way that I can return multiple rows from a stored
    : : procedure for function ?
    : : Something like:
    : : CREATE FUNCTION sp_get_children (my_nip IN port.nip_num%
    TYPE)
    : : RETURN my_nip
    : : IS
    : : CURSOR child_cur IS
    : : SELECT nip_num
    : : FROM logical_port
    : : WHERE port_num = my_nip;
    : : child_rec child_cur%rowtype;
    : : BEGIN
    : : FOR child_rec IN child_cur
    : : LOOP
    : : RETURN my_nip;
    : : END LOOP;
    : : END tmp_sp_get_children;
    : : I know how to do it in Informix ( RETURN WITH RESUME ), but
    : I'm
    : : not running Informix ;)
    : : Thanks,
    : : Phil
    : In contrast with Informix, SQL Server and Sybase, Oracle
    : can not return a result set. the only workaround is to
    : return the cursor variable as such.
    null

  • How to execute multiple queries in one stored procedure.

    Hi,
    I am Kumar,
    How to execute multiple queries in one stored procedure.
    here is the my requirements,
    1. get the max value from one table and sum of the that value.
    2. insert the values and also sum of the max value.
    using stored procedure
    I am using SQL server 2000 database.
    Please help me.
    Advance thanks
    by,
    Kumar

    This is not a java question and it is not even a problem: your only problem is
    1) lack of knowledge
    2) lack of interest to find a manual
    But you are going to have to change both by actually reading a book or a manual that explains the stored procedure language of SQL Server. It is the same as Sybase I think, so you could also look for a manual for that DBMS.

  • Problem in running a java stored procedure&optimum settings for this needed

    hi
    we are using java stored procedures to read huge data from database tables and transfer them to another system.
    the procedure is running fine but it fails after transferring 60000 records, the execution of procedure here does not terminate but keeps running with out performing any data transfer....since it does not give any error it is difficult for us to know what the actual problem is !!!!!!
    i have checked the code many a time and i dont see any infinite loops in that code.
    please give any pointers on why this might be happening?
    please also give all the parameters which need to be taken care of while running a java stored procedure
    thanks
    regards
    asif

    But the same thing works fine with a jdbc program
    the table name is converted
    The same convert.transform method is being used to do the conversion
    please help
    ISQL is similar to SQL prompt inOracle
    it is like,
    ISQL>
    Regards
    khurram

  • Subreport using the same Stored Procedure

    I have a main report and a subreport that uses the same stored procedure. The stored procedure has 12 parameters and what I want to avoid is the user having to enter the same parameter values twice. When I created the subreport I put in the parameters + one field, the employee id field so that I could just test it on one employee.
    After I entered the subreport into the main report, when I got to refresh the data, it's asking for params for BOTH reports. Is there any way to get around this? Because of the way the stored procedure returns the data, I had to create a subreport instead of just fitting it into one of the footers. I've looked at the subreport link and added the employee id as the key. When I ran it the first time, it returned the wrong date range on the sub.
    Help! this thing is Way passed due!!

    Right click on the sub report and choose change sub report links
    Top left pane contains your main report parameters use > to add
    In the bottom left corner of that dialog then scroll down until you see the corresponding sub report parameter
    Repeat for each parameter
    This should then take the main report params and pass into the sub report

  • To execute the same stored procedure multiple times

    Suppose I have this :
    select distinct batch_id, submit_date from batch where date > xxx;
    Gives me :
    301
    305
    306
    Currently, I have a stored procedure PROC_A that has 3 cursors all of which have a field called batch_id(which ofcourse exists in the above batch table). Hence, when I run as of today
    EXECUTE PROC_A;
    This could process an unpredictable set of batch ids. I am looking to avoid this.
    What I am trying to achieve here is :
    When I do,
    select distinct batch_id from batch where date > xxx;
    301
    305
    306
    For each of the above values, I want to call the PROC_A exclusively. In other words, by one shot, I want this procedure to be invoked 3 times, each time processing just one batch_id one after another (rather than passing those 3 values to the procedure and having it execute just once !). I also want to avoid using the batch table anywhere inside the stored procedure PROC_A.
    How do I achieve this ? If another stored procedure can call PROC_A, I am okay with including the batch table there.

    What about an executed_date field on the table and a "where rownum=1" in the cursor?
    proc_a
    begin
         begin
              select batch_id
              into b_id
              from batch ...
              where date > xxx
                   and date > last_executed
                   and rownum = 1;
         exception
              when NO_DATA_FOUND then
                   return;
         end;
         exec(b_id);
         update batch
         set last_executed = sysdate
         where bacth_id = b_id;
         return;
    end;Bye Alessandro

  • MULTIPLE VALUES PASSING TO STORED PROCEDURE

    Hi, 
    I have a following stored procedure, I am passing two parameters from the drop down list by using a different dataset. User is selecting multiple values from drop down list in reporting services from
    code a drop down and code b drop down.
    I have put the JOIN(Parameters!qual_codea.Value,",") in dataset property for both parameters. But it is only displaying first row in the report. In report I have used simple table and Drag Total, Qualification Code A and Qualification Code B in
    three columns respectively.
    Any Idea why it is not displaying the remaining data for other codes selectedfrom drop down. If i run a query in management studio by using in operation with multiple codes, it display multiple rows which is correct but it is not happening in reporting services.
    Any Idea?
    ALTER PROCEDURE [dbo].[Multiple_Qualification_Summary]
    @qual_codea nvarchar(10),
    @qual_codeb nvarchar(10)
    AS
    select DISTINCT
    COUNT(b.PRN) as Total
    ,A.UKCC_Qualification_Code AS 'Qualification Code A'
    ,b.UKCC_Qualification_Code as 'Qualification Code B'
    from dbo.Practitioner_Register_Part_Status as a, dbo.Practitioner_Register_Part_Status as b, dbo.Qualification_Register_Part as c
    where a.PRN = b.PRN
    and a.UKCC_Qualification_Code = @qual_codea
    and b.UKCC_Qualification_Code = @qual_codeb
    AND A.IsLatest = 1 AND B.IsLatest = 1
    AND A.UKCC_Qualification_Code = C.UKCC_Qualification_Code
    AND C.QUALIFICATION_ACTIVE_SWITCH = 1
    group by A.UKCC_Qualification_Code
    ,b.UKCC_Qualification_Code
    order by 1
    MH

    Hi Sathya,
    Thanks for your reply, do i need to change the stored procedure? According to your link it suggest i have to use XML?
    MH
    Try this - Passing multi-value parameter in stored procedure 
    Shahfaisal Muhammed http://shahfaisalmuhammed.blogspot.com

  • Multiple result sets from stored procedure into CachedRowSet

    How can you obtain multiple sets of data from a stored procedure that returns multiple result sets, when you'd like to use CachedRowSet rather than ResultSet?
    My database's stored procedures return multiple result sets, but I'm not sure how to manipulate that using CallableStatements and CachedRowSets... I read the RowSet tutorial from java.sun.com but that didn't cover the case of multiple result sets and CallablStatements.
    How might I do this? Thanks a lot.

    SELECT columns..
    FROM table
    FOR XML PATH('NodeName'),('Rootname')
    Thank you for replying.
    I dont have to generate XML from a query. I have to generate from a SP and that too without modifying it.
    Thanks,
    Tauhid
    thats ok you can do like this
    1. Create a table with structure same as SP resultset
    2. Populate table with SP result as per below
    INSERT table
    EXEC SPName param1value,...
    3. Add a query like below
    SELECT columns..
    FROM tablename
    FOR XML PATH('NodeName'),('RootName')
    see
    http://visakhm.blogspot.com/2014/05/t-sql-tips-fun-with-for-xml-path.html
    4. Use sp_send_dbmail to sent it through mail
    http://msdn.microsoft.com/en-IN/library/ms190307.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How do i insert multiple blob files in Stored procedure using c#?

    i want to add multiple blob files to a stored procedure at one go.Thus i have a 2 dimensional byte array consisting of multiple blob files.How to i add this 2 dimensional array to stored procedure?

    Hi Jeff,
    I haven't tried to insert multiple images at a time, but have done it for single image at a time and composed article on it : BizTalk
    Server 2010: How to Insert Image In SQL Through Orchestration and sample can be found at : 
    BizTalk Server 2010: How to Insert
    Image In SQL Through Orchestration sample.
    I hope it helps.
    Maheshkumar S Tiwari|User
    Page | http://tech-findings.blogspot.com/

  • Importing function with multiple ref cursors in Stored Procedure of Oracle 12c database Using EF6

    Hi Good day!
    I can able to import function for stored procedure of oracle db and able to add the complex type and get the output but i tried to import the procedure which having two ref cursors and unable to retrieve the column information. Only able to retrieve the
    columns of first ref cursor.  Please help me to get the result of two ref cursors which acting as out parameters.

    Having to ref cursors return mutiple recordsets in an Oracle package is like haveng two resultsets return from a MS SQL Server sparc.
    The link may point you in the right direction.
    http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram

  • Run report in stored procedure

    Could anybody help me to run the report in stored procedure? I
    created a report in the way below:
    start report builder-> build report manually->(object Navigator)-
    program unitcreated a pachage spec and body
    When I go to the live viewer, it asked to create a layout, but
    the it asks a sql statement if I go layout model.
    Is there any way to run this report or I did something wrong?
    Also, how to run a stored procedure from the database, please
    provide as many details as you can since I am new to report.
    Any help will be greatly appeciated

    hello,
    i am not quite sure if i understand you correctly, but in oracle
    reports you do not create a report using PLSQL packages.
    you define a datamodel and then create a layout. the best way is
    if you run through the wizard to create a first version fo the
    report.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Inserting Multiple Line Items To Stored Procedure

    Hi
    I need to insert line item values to one of the argument in stored procedure.what data type do i need to pass for type attribute.I tried with different datatypes from sap help but no luck.Please guide me how should i proceed.
    Interface is : Idoc to JDBC (stored procedure)
    Target structure:
                                     DT_Orderstatus_Trgt
                                         --> StatementName
                                                 -->SP Name
                                                        action--->Attribute
                                                        table--->Attribute
                                                         --->Argument (to insert multiple line items)
                                                                 isInput
                                                                 isOutput
                                                                 type
    Just i am showing only one argumnet which needs to be inserted multiple line items.
    Thanks

    Hi,
    Stored procedure can support the below data types
    INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver).
    But
    Instead of passing multiple line items / array of input value in stored procedure, You can go for the below option as having 2 statements in your mapping with below structures and those 2 statements should be linked with the primary key say col1.
    <root>
    <StatementName1>
    <dbTableName action=u201DINSERTu201D>
    <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2</col2>
    </access>
    <access>
    <col1>val11</col1>
    </access>
    </dbTableName>
    </StatementName1>
    <StatementName2>
    <dbTableName action=u201DINSERTu201D>
    <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2</col2>
    </access>
    <access>
    <col1>val11</col1>
    </access>
    </dbTableName>
    </StatementName2>
    </root>

  • Applescript to run SQL Server stored procedure on Mac

    Hello All,
    I'm new to applescript. I've a stored procedure in SQL server that generates a uniqque Jobnumber. I need to run this stored procedure from applescript and display the new job number to the user. How can I achieve this using Applescript? Is there any other alternative? Any suggestion/inputs are welcome.
    Thanks

    There's no simple, direct MySQL interface within AppleScript - that is, you can't (easily) connect to your database directly and execute the stored procedure.
    The commonest solution to this is to use the command line mysql interface via do shell script.
    set myData to (do shell script "/usr/local/mysql/bin/mysql -u USERNAME -pPASSWORD -e '<SQL statement here>'")
    There's a lengthy discussion, including examples, at http://macscripter.net/viewtopic.php?id=24721

  • Run PL/SQL stored procedure under JSP

    Quick question: how do I run a Stored Procedure built on PL/SQL from my JSP program.
    I'm using JDEV 9i, and Oracle 9i.
    Thanks.

    REPOST Again, please, don't let me die.!.

  • Passing multiple values to a stored procedure

    Hi All,
    I have a stored procedure which displays a chart. The header of this procedure is:
    create or replace procedure chart ( p_period IN VARCHAR2) is
    When calling this procedure with something like the folloeing:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=MONTH">
    everything works OK.
    Now, I would like to replace p_period=MONTH with a value coming from an ITEM on the page, so something like:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=:P13_PERIOD">
    However, the above doesn't work.
    Can anyone give me the correct syntax please?
    Also what would be the syntax for passing more than one value? ie:
    source=ohsinit.chart?p_period=:P13_PERIOD,p_start=:P13_START_DATE ?
    Regards,
    Pawel.

    Hi Denes,
    I am not sure I understand your post...
    What I am trying to do here is to pass 3 values namely
    P13_PERIOD (VARCHAR2),
    P13_START_DATE (DATE),
    P13_END_DATE (DATE)
    into a stored procedure which displays the graph.
    So far I managed to get it working using:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=&P13_PERIOD.">
    However when I try to put in:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=&P13_PERIOD.,p_start=&P13_START_DATE.">
    I get the graph blank (but not the orange timeout message... if you are familiar with XML/SWG graphs.)

Maybe you are looking for