Saving the output of a .sql file in .csv format

Hi,
I am saving the output of a .sql file in .csv format. But the problem is , the record of few columns have "new line" character in it, so when it is getting saved in .csv format, those records are coming in multiple rows, but they should come in one single row in single block. Please advise how to overcome this problem.
Regards,
Niraj

Hi Guys,
I guess, there is a misunderstanding.
He is talking about the issue caused as a result of the data containing a "CRLF" ( Carriage return Line feed ) .
That is mainly a data issue.
The query i presume, must be right.
I guess you should be able to fix it using some string functions.
Some thing similar to this
CREATE TABLE ASH (NAME VARCHAR2(10))
SELECT REPLACE(NAME, CHR(13)||CHR(10), 'ISH') FROM ASH;
SELECT REPLACE(NAME, CHR(10), 'ISH') FROM ASH;
SELECT REPLACE(NAME, CHR(13), 'ISH') FROM ASH;
depending on the type of new line whether it is CR or LF. or CRLF.
Regards
Ashish/-

Similar Messages

  • Update LIKP table while saving the output type in VT02N transaction

    Hi All,
    I have a requirement where i have to update Delivery Priority(LPRIO) field in LIKP table while saving the output type in VT02N transaction. I am not able to use the BAPI "BAPI_OUTB_DELIVERY_CHANGE" or FM "WS_DELIVERY_UPDATE" because, when we save the output type the programs that are configured in NACE are triggered in update mode and hence i will get a roll back error.
    Let me know other ways of updating the table at the time of saving output type for shipment transaction VT02N.

    This could be a result of one of the following reasons:
    1: Incorrect smart form/routine assigned in the output configuration (NACE)
    2: Serial number range of the delivery expired
    3: The default settings of the user (SU01) processing the delivery is missing the default printer name.
    Hope this is helpful
    Manish

  • Some examples in saving the output into memory

    After running the class file i would like to save the results into memory, and then update the results in memory every time the program runs including the number of times it checked whatever it is going to check with the result of that checking. Then saving the results into a .txt file every time the program goes to sleep for an hour, as it has while(ture) loop.
    Will storing data in a variable save it into memory?? (example if u can please)
    I will be gratefull if you could tell/show me how to to save the results into memory and then update these results (i will need examples please). As having the program in a while(ture) loop and saving the result into a .txt file has been done.
    Thanks a lot in advance.

    i am sorry if i did not make myself clear, but i dont know how to do that, if there r any examples so I could understand it, i am sorry again. What i am trying to do is to store some information to memory and then update and retrieve these information later on and write it into a file, and do the same every hour.
    I am sorry for not understanding it and for not making anyone to understand it.

  • DME output files in CSV format

    Hi,
    Can anybody please let me know whether we can get the DME output files in CSV format using program RFFOJP_L?
    Your help and time will be really appreciate.
    Thanks & Regards,
    Niki Shah
    Edited by: Niki Shah on Aug 5, 2009 10:14 AM

    No it will not work. You need full Photoshop (CS5)

  • How to convert the output of Applescript which is in object format to text or string format??

    Hi All,
    I want to convert the output of Applescript which is in object format to string or text format, am running Applescript with Java, I need to display the output of applescript in Eclipse Java Console, since its object format the output is not properly displayed..
    Pls suggest.. I used the below code
    repeat with i in allContents
                if class of i is button then set the end of allStaticText to contents of i
            end repeat
    Applscript ouptput
    {button 1 of window "Player Installer" of application process "Install  Player" of application "System Events", button 2 of window "Player Installer" of application process "Install  Player" of application "System Events", button 3 of window "Player Installer" of application process "Install  Player" of application "System Events", button "Finish" of UI element 1 of scroll area 1 of window "Player Installer" of application process "Install  Player" of application "System Events"}
    Java output
    <NSAppleEventDescriptor: 'obj '{ 'form':'indx', 'want':'butT', 'seld':1, 'from':'obj '{ 'form':'name', 'want':'cwin', 'seld':'utxt'(" Player Installer"), 'from':'obj '{ 'form':'name', 'want':'pcap', 'seld':'utxt'("Install  Player"), 'from':'null'() } } }>

    Here's an improved version of the previous script, where the handler now returns "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"" instead of "button \"2\" of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"":
    tell application "System Events"
        get button 2 of window 1 of process "TextEdit"
        my objectToText(result) --> "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\""
    end tell
    on objectToText(UI_element)
        set theText to ""
        tell application "System Events"
            repeat
                if exists attribute "AXParent" of UI_element then
                    set theParent to value of attribute "AXParent" of UI_element
                    set theClass to class of UI_element
                    if name of UI_element exists then
                        set theName to name of UI_element
                        set theText to theText & (theClass as text) & " \"" & theName & "\" of "
                    else
                        set k to 0
                        get UI elements of theParent whose class is theClass
                        repeat with thisItem in result
                            set k to k + 1
                            if contents of thisItem is UI_element then exit repeat
                        end repeat
                        set theIndex to k
                        set theText to theText & (theClass as text) & " " & theIndex & " of "
                    end if
                    set UI_element to theParent
                else
                    set theClass to class of UI_element
                    set theName to name of UI_element
                    set theText to theText & (theClass as text) & " \"" & theName & "\" of application \"System Events\""
                    exit repeat
                end if
            end repeat
        end tell
        return theText
    end objectToText
    Message was edited by: Pierre L.

  • BW System - F.M to down load the file to CSV format

    Hi All,
    Canm any one plz let me what is the F.M to down load the file to CSV format in BW system

    Hi,
    try using this FM  " /LICMAN/UT_CONVERT_ITAB_2_CSV" to conver the data to CSV. then call GUI_Download to download
    Regards,
    Aditya

  • Need help in writing data to a flat file in .csv format

    Hi All,
    could you please show with a sample example to write data in .csv format using UTL_file.
    The result of the refcursor i want to write to a file in .csv format.
    How can i achieve this.
    Thx

    Hi,
    There are two ways to acheive this.
    First and which I prefer is creating a SQL script which will generate csv file at the specified location in CSV format. And then this SQL script can be called from your cron job similar to how you call stored procedure. Following is pseudo code that can be used -
    set linesize 500
    set echo off
    set feedback off
    set prompt off
    set pagesize 0
    spool <name of the csv file>.csv
    <Your select statement>;
    spool offPut select statement delimiting columns you want to use with ','. E.g. following query should create a CSV file named as abc.csv with one record and 2 columns delimited by comma. First column is ENO and second column is ENAME.
    set linesize 500
    set echo off
    set feedback off
    set prompt off
    set pagesize 0
    spool abc.csv
    select ENO || ',' || ENAME from employee;
    spool offSecond, you can write a PLSQL procedure and then call this procedure from cron job. There is a generic procedure shared by BluShadow some time back which is a very good example for this. Please refer to following link for this solution -
    REF Cursor creating CSV files
    I will suggest to use first method above if possible since it will be faster and less complicated in my opinion. Second method is recommended for scenarios where select statement is created dynamically and cannot be written during development.
    Hope this solves your purpose.
    Cheers,
    Anirudha

  • Issue while downloading file in .CSV format

    Hi,
    I need to download the file in .CSV format.
    I hade used FM SAP_CONVERT_TO_CSV_FORMAT  and then used GUI_Download.
    Now when I am opening file which is downloaded, it gives all the data in a single column. If there are 5 fields in my table, the generated file gives the data of all the 5 fields in a single column.
    Could you please help?

    Hi try wi th the following code.
    TYPE-POOLS : truxs.
    DATA: t_file TYPE STANDARD TABLE OF type_file.
    data:t_conv_data TYPE truxs_t_text_data.
    CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
      EXPORTING
        i_field_seperator          = ', '
      TABLES
        i_tab_sap_data             = t_file
    CHANGING
       i_tab_converted_data       = t_conv_data
    EXCEPTIONS
       conversion_failed          = 1
       OTHERS                     = 2.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = 'C:\TESTCSV.CSV'
        filetype                = 'ASC'
        write_field_separator   = '  '
      TABLES
        data_tab                = t_file
       fieldnames              = names
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.

  • Converting flat files to csv format

    hi,
    Iam converting flat files to csv format..the problem is that iam running a script for inserting values.while i run this script it works fine .but while i open this csv file the datas in the excel sheet is not coming in a single line that is for a particular record its moving to second line .there is a break for a single record.so there is a problem in conversion.can anything be done in it this to avoid the breaking of lines
    thanks
    Ratheesh

    YOGenereally, you shouldn't convert from a lossy format AAC or MP3) to another lossy fomrat.
    It's called loss because you lose information when you convert it.
    If you only use these files on the computer and the iPod, I'd recommend AAC. Better quality at same bit rate as MP3.

  • Downloading Excel File in CSV Format

    Hi All,
    How can I Download a file in .CSV Format?
    I am using the below shown code.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'C:\Documents and Settings\sandeepp3\Desktop\sample.csv'
        FILETYPE                        = 'DAT'
      APPEND                          = ' '
        WRITE_FIELD_SEPARATOR           = ','
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      SHOW_TRANSFER_STATUS            = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = ITAB
        FIELDNAMES                      = HTAB
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I am getting the field separator as Tab(SPACE).
    Please Advise

    Hi Anil,
    Try this way.
    REPORT ztest_notepad.
    "Declarations
    TYPE-POOLS :truxs.
    DATA : it_download TYPE truxs_t_text_data.
    DATA: BEGIN OF it_data OCCURS 0,
            arbgb TYPE t100-arbgb,
            msgnr TYPE t100-msgnr,
            text TYPE t100-text,
          END OF it_data.
    START-OF-SELECTION.
      "Select Data
      SELECT * FROM t100
      INTO CORRESPONDING FIELDS OF TABLE it_data UP TO 200 ROWS   WHERE sprsl = sy-langu.
      "Convert SAP to CSV format
      CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
        EXPORTING
          i_field_seperator    = ';'
        TABLES
          i_tab_sap_data       = it_data
        CHANGING
          i_tab_converted_data = it_download
        EXCEPTIONS
          conversion_failed    = 1
          OTHERS               = 2.
      IF sy-subrc = 0.
        "Download data using GUI_DOWNLOAD
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename = 'C:\test.txt'
            filetype = 'ASC'
          TABLES
            data_tab = it_download.
      ENDIF.
    Thanks
    venkat.O

  • How to write the output of an SQL query to a text file?

    I am using Oracle 11g and SQL plus.
    I have a large table called rating.
    Whenever I do
    SQL> select * from rating;
    The output goes much beyond what the SQL Plus screen can show. I want to therefore store the output of this query into a text file.
    How can this be done? Please help. Thanks.

    SQL> SPOOL results.txt
    SQL> select * from rating;
    SQL> SPOOL OFF

  • Adding numbers in a file a and saving the output in another file.!

    can any one pls tell me how to add numbers from a textfile and save the output in another textfile. i'm new with java so pls help out..

    Hi Friend,
    your statement is not clear, it's bit confuse
    this is my unserstanding,
    you want to open a file and read the values then add numbers,
    latter save the sum in a new file.let me know if this is the thing, I can help u
    with Cheers
    Prasanna

  • Saving the output of java programs in files

    How I do save the output of a program to a MS - DOS file ?

    import java.io.*;
    use FileOutputStream /BufferedOutputStream class.....
    read tutorials or books about JAVA on these technology
    U can find many examples in this site too

  • How to Suppress The Output of a SQL Query In Oracle 11gR2

    Hi Friends,
    I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
    For example:
    SQL> set timing on;
    SQL> SELECT objProp FROM aradmin.arschema WHERE (schemaId = 175);
    OBJPROP+
    --------------------------------------------------------------------------------+
    *6\60006\4\0\\60008\40\0\60009\4\0\\60010\4\0\\60018\4\0\\600*
    *22\4\68\1\63\AR:jRL#*
    Elapsed: 00:00:00.00
    The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
    Please help me at the earliest.
    Regards,
    Arijit

    >
    I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
    The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
    >
    How would that even be useful?
    A query from a tool such as sql*plus is STILL going to send the output to the client and the client. You can keep sql*plus from actually displaying the data by setting autotrace to trace only.
    But that TIME TAKEN is still going to include the network time it takes to send ALL rows that the query returns across the network.
    That time is NOT the same as the actual execution time of the query. So unless you are trying to determine how long it takes to send the data over the network your 'timing' method is rather flawed.
    Why don't you tell us WHAT PROBLEM you are trying to solve so we can help you solve it?

  • How is the output of TempDBAnalysis.sql run during a SQLDiag.EXE session used to troubleshoot tempdb contention?

    Hi,
    I recently came across the option in PSSDiag configuration utility to collect data using the "SQL 2005 tempdb Space and Latching" option.  I executed this on a test server and it generated the file {servername}_TempDBAnalysis_Startup.out. 
    This contains the output of a set of queries that are run in a 10s loop. 
    I have two questions regarding this output.
    1.  Are there any of the analytical tools in SQLNexus or PAL that display, summarize, or trend this data in any way? I do not see any but would like to confirm with the forum.
    2. If there are no analytical outputs, is there any summary out on the web of how to analyze this data, how to import it into a db, or how to interpret the output of each individual query?
    Thanks in advance for any assistance in this matter!

    Hi Lorrin,
    You can reference the below links.
    Tool to help you analyze SQL Server SQLDIAG and PSSDIAG output
    How to use SQLDiag, SQLNexus and PAL tools to analyze performance issues in SQL Server
    If you have any feedback on our support, please click
    here.
    Eric Zhang
    TechNet Community Support

Maybe you are looking for