Automic Workload Automation

 View Only
  • 1.  INSERT TABLE TO SQL USING VARIABLES

    Posted May 26, 2022 09:56 AM
    Hello everyone,

    I want to ınsert table to SQL database using variable object that I created.


    I want to insert DATA_TYPE values to SQL table.


    I tried different version in SQL Statement  and does not work (I can not set values as 'JOBS' in SQL table);

    {VARA.NEW.1,DATA_TYPE,1}
    {VARA.NEW.1,DATA_TYPE,2}
    &DATA_TYPE#
    DATA_TYPE#

    SQL table results


    How can I manage this problem? Thanks for any input.



  • 2.  RE: INSERT TABLE TO SQL USING VARIABLES

    Broadcom Employee
    Posted May 27, 2022 01:10 AM
    Hi,
    SQL VARA objects are for retrieving values from external databases, not to insert data. 
    If you would like to insert data please use an SQL job.
    Regards, Markus


  • 3.  RE: INSERT TABLE TO SQL USING VARIABLES

    Posted May 27, 2022 07:34 AM
    Thank you for your answer. I have one more question. How can I insert data using SQL JOB?


  • 4.  RE: INSERT TABLE TO SQL USING VARIABLES

    Posted May 27, 2022 10:33 AM
    Here is an example of an update:

    UPDATE SPSOFT.PS_FA_BATCH_RUNCTL
    SET AID_YEAR = &AIDYEAR#
    WHERE PRCSNAME = 'FABUDGET'
    AND INSTITUTION = 'FSU01'

    So, declare your variables from the vara and use them in the insert where needed.  I looked for a specific insert using a variable, but only found updates.  In principle, the passing of a variable in SQL would be the same for Inserts/Updates/Deletes/Select.

    ------------------------------
    Cheers,

    Gary Chismar
    Manager, Automic, PeopleSoft HCM/FI
    Florida State University
    Florida
    ------------------------------



  • 5.  RE: INSERT TABLE TO SQL USING VARIABLES

    Posted Aug 18, 2022 02:36 PM
    Thank you for your answer, How can I use SQL JOBS for that, can you give an example?
    Thanks for any input.


  • 6.  RE: INSERT TABLE TO SQL USING VARIABLES

    Broadcom Employee
    Posted Aug 19, 2022 04:27 AM
    First of all you need to install a SQL agent. Then create an SQL job, connect it to the target database using a connection object and finally put an
    INSERT xxx into yyy
    statement into the Process tab.