ESP dSeries Workload Automation

 View Only
  • 1.  DB Query To CSV File Format

    Posted Mar 04, 2020 03:36 PM
    Hi Guys,

    Can DE Series DB Agent job query a table and format the output as a CSV format without the need to write the query with concatenation || etc.

    It would be nice to be able to export the data to a readable format than just the spool format.

    Thanks


  • 2.  RE: DB Query To CSV File Format

    Broadcom Employee
    Posted Mar 05, 2020 02:15 AM
    Hi,
    Can you look at the 'Output File' option in the SQL job type as shown below in color.

    Hope it helps!
    - Ravi Kiran


  • 3.  RE: DB Query To CSV File Format
    Best Answer

    Posted Mar 05, 2020 09:37 AM
    Edited by Christopher Hackett Jun 09, 2020 06:44 PM
    Hi Kunduri,

    OK, but the output still has the query at the top of the output.
        Output for:
    The fields are not comma separated.
    As a result if I open in Excel it does not open with columns separated.
    Annoyingly it also has heading under lines "----------------------" below the column names.   You may need to delete that row.

    To create a workable sheet I have to use Data-Text To Columns and base it on White Space as it is not even tab deliminated.
    If your data is VARCHAR and has white space in the value it will split that based on white space too.


    Has it been enhanced in 12.2?







  • 4.  RE: DB Query To CSV File Format

    Posted Jun 24, 2022 11:38 AM
    Hi Ravi,

    Any ability to set at the agent level the field delimiter you want for SQL Query output.
    Also the SQL Query is in the resulting file, this is not ideal for client deliveables.

    Thanks

    David


  • 5.  RE: DB Query To CSV File Format

    Broadcom Employee
    Posted Jun 27, 2022 04:52 AM
    Hi,

    There is no such delimiter configuration setting.

    - Ravi Kiran


  • 6.  RE: DB Query To CSV File Format

    Posted Jul 04, 2022 05:22 PM
    If you're in a Windows environment, you could add a subsequent powershell job to convert the output to CSV

    $results = get-content -path "path to sql output"
    $results | Export-Csv -Path "path to csv" -NoTypeInformation​


    ------------------------------
    Andy Reimer
    ------------------------------