BULK INSERT from a text (.csv) file - read only specific columns.

I am using Microsoft SQL 2005, I need to do a BULK INSERT from a .csv I just downloaded from paypal.  I can't edit some of the columns that are given in the report.  I am trying to load specific columns from the file.
bulk insert Orders
FROM 'C:\Users\*******\Desktop\DownloadURL123.csv'
   WITH
              FIELDTERMINATOR = ',',
                FIRSTROW = 2,
                ROWTERMINATOR = '\n'
So where would I state what column names (from row #1 on the .csv file) would be used into what specific column in the table.
I saw this on one of the sites which seemed to guide me towards the answer, but I failed.. here you go, it might help you:
FORMATFILE [ = 'format_file_path' ]
Specifies the full path of a format file. A format file describes the data file that contains stored responses created using the bcp utility on the same table or view. The format file should be used in cases in which:
The data file contains greater or fewer columns than the table or view.
The columns are in a different order.
The column delimiters vary.
There are other changes in the data format. Format files are usually created by using the bcp utility and modified with a text editor as needed. For more information, see bcp Utility.

Date, Time, Time Zone, Name, Type, Status, Currency, Gross, Fee, Net, From Email Address, To Email Address, Transaction ID, Item Title, Item ID, Buyer ID, Item URL, Closing Date, Reference Txn ID, Receipt ID,
"04/22/07", "12:00:21", "PDT", "Test", "Payment Received", "Cleared", "USD", "321", "2.32", "3213', "[email protected]", "[email protected]", "", "testing", "392302", "jdal32", "http://ddd.com", "04/22/03", "", "",
"04/22/07", "12:00:21", "PDT", "Test", "Payment Received", "Cleared", "USD", "321", "2.32", "3213', "[email protected]", "[email protected]", "", "testing", "392932930302", "jejsl32", "http://ddd.com", "04/22/03", "", "",
Do you need more than 2 rows? I did not include all the columns from the actual csv file but most of it, I am planning on taking to the first table these specfic columns: date, to email address, transaction ID, item title, item ID, buyer ID, item URL.
The other table, I don't have any values from here because I did not list them, but if you do this for me I could probably figure the other table out.
Thank you very much.

Similar Messages

  • Read only specific Columns into the cursor

    Hey everybody,
    I'm trying to make a cursor which takes only column 2 to n-2 (when n is the number of cloumns). The table size should be variable.
    Is there any possibility to do that?
    Like
    CURSOR nodes IS SELECT * FROM nn_input WHERE column_id > 1 AND column_id < count(columns)-2;
    Another possibility to solve the problem could be to read all cloumns in the cursor and then, in the for-loop, writing the 2nd to (n-2) value in table1 and the last two values in table2...
    Anyone an idea? Thanks a lot!

    You need to use dynamic SQL and build up your query at run time. You could use something like the following to generate the list of columns...
    CREATE TABLE test_columns
    col1 number,
    col2 number,
    col3 number,
    col4 number,
    col5 number
    SELECT LTRIM(MAX(SYS_CONNECT_BY_PATH(column_name,',')),',')
    FROM   user_tab_columns
    START WITH column_id = &start_col_num
    AND        table_name = 'TEST_COLUMNS'
    CONNECT BY column_id = PRIOR column_id +1
    AND  table_name = PRIOR table_name
    AND  level <= &end_col_num-&start_col_num+1;Using a start_col_num =2 and end_col_num=4 gives:
    LTRIM(MAX(SYS_CONNECT_BY_PATH(COLUMN_NAME,',')),',')
    COL2,COL3,COL4There are lots and lots of other options...
    Greg

  • Insert Data into Table from TXT or CSV file !!!!!

    Dear All,
    Recently I have started working on APEX. In Oracle Forms, we used to use TEXT_IO for inserting records into tables from txt files. Now I want to do the same thing in apex 3.2. How can I insert data into tables from txt of csv files.
    Waiting of your valuable suggestions.
    With kind regards,
    Yousuf.

    Yousuf
    wwv_flow_files is used by APEX to hold uploaded files.
    If you incorporate a file browse item on you page, browse for the selected file, then submit the page (having the PL/SQL process described as an on suibmit process) then what I detailed should work.
    If you don't need users to have access to this then just go to Home>Utilities>Data Load/Unload in APEX and there is a handy load utility there that does it all for you.
    Cheers
    Ben

  • How can I have a csv file read from excel to labview.

    Hi,
    I would like to read multiple csv files from excel to labview, creating a duplicate of the tables in excel, which would allow me to then draw some graphs for data analysis and comparison between the two.
    Are there any examples that could be useful to what I am trying to do?
    Thanks

    Patel33 wrote:
    From one of the csv files, I only require 3 of the columns. Is there a way to only read that part of the csv file?
    No. The characters in a file are just one long string and delimiters and linefeeds are special characters that defined where fields and lines start and end. As such, columns are interlaced into the file and consists of many small sections, where the position depends on the number of characters in each field, which is typically variable. You really need to read the entire file, then only look at the interesting columns later.
    LabVIEW Champion . Do more with less code and in less time .

  • Download data from db to CSV file and need to handle chinese character

    Hi , all , I need to write to alow to export data from db to csv file, now the problem is some column is chinese character, in both db and web page it can dispaly the chinese, but in Csv I can't display chinese character, what should I do?
    Thnak you

    HJava wrote:
    I already have res.setCharacterEncoding("UTF-8"); in my servlet, and db
    req.setCharacterEncoding("UTF-8");
    Are you sure that you have set it on the response? You do not need to set it on the request. Have you read the article? Do you understand the world of characters? It look like you still don't understand it.
    by the way, since csv is text file , how can I bold my University number??? in sb = new StringBuffer();
    sb.append("University Number");Not possible with CSV since it is text/plain. Use real XLS if you want to add formatting to cells.

  • How to import data from excel or csv files to Oracle table

    hello everybody,
    I am new here and new in Oracle. I would like to know the steps how to import data from excel or csv files to Oracle table.
    Let say I already have table inside the Oracle. Then my user give me the sets of data inside the Excel Worksheet.
    So, how can I import the excel data into Oracle table.
    Thank you in advance.
    cheers,
    shima

    Even easier. Download JDeveloper 11G from this site.
    Set up the database connection, right click on the table, select Import->Excel and specify your file to load it. On the import pop-up, you must view and update each tab indicating Columns, Data Types, and DML.
    Columns -- move the selected columns that you want to load to the box on the right
    Data Types -- select column name from second column to which the data for each column of the import file should load
    DML -- click this tab to generate the INSERT SQL
    Once done click 'Insert'

  • Program to read only specific words in each Line in a text file

    Hi
    I have a question
    I need to write a program where the program must read only specific words in each line
    I will give you an example...
    PSAPPSRV.21201      1-42 13.35.54 238.360 Cur#1.HDEV RC=0 Dur=0.000 COM Stmt=SELECT VERSION FROM PSVERSION WHERE OBJECTTYPENAME = 'SYS'
    PSAPPSRV.21201      1-43 13.35.54 0.040 Cur#2.HDEV RC=0 Dur=0.000 COM Stmt=SELECT STYLESHEETNAME FROM PSOPTIONS
    These are two lines in my text file...now I need to read only the SQL statements present that is both SELECT statements.. Can you please suggest a method.......

    My first reaction to the question is why would you want such thing, but may be I am unknown :)
    Assuming you have the text as string, I mean
    String str = "PSAPPSRV.21201 1-42 13.35.54 238.360 Cur#1.HDEV RC=0 Dur=0.000 COM Stmt=SELECT VERSION FROM PSVERSION WHERE OBJECTTYPENAME = \'SYS\'";you can obtain the sql statement using substring method like
    String result = str.substring(str.indexOf("SELECT")); Again I assume there is no word SELECT preceding and the word SELECT is all caps.

  • Counting lines in a text/csv file.

    Can you advice me, how I can get the total number of lines in a text/csv file please using java code.
    I will get the text/csv file content in a string variable not as a file.
    EX: string var = "123\n234\n123\n3456\nsdfsd\n" here \n is in the new line.
    for this I have to get the total lines as 5.
    Please advice.
    Thanks.

    Kayaman wrote:
    user12679330 wrote:
    Oh ok.. ignore the last one, Any idea on this please.Count the newline characters like morgarl told you. You're being very difficult to help for such a simple problem.Thats because nobody has posted the code yet dude ;)
    I'm pretty sure that once the OP finally takes the hint and writes the two lines of code needed to solve this question, he'll come up with something that sometimes gives the correct answer and other times gives a count that is one-off.

  • How to save and open Text/csv file over APS

    Hi,
    I want to save(and open later) data from database block in text/csv file format over Application server, I did a lot of search here on Forms but didn't found a reasonable solution, Some one plz help me.
    Thanks and Regards, Khawar.

    As long as you are using the Report Generation Toolkit, there is no need to use ActiveX for the purpose of saving the Excel file -- Save Report will do that for you.  You can then export (as text) all of the Excel data and use the Write Spreadsheet File to make the .CSV file.  Here is how I would rewrite the final bits of your code --
    I cleaned up the wires around Excel Easy Table a bit.  You'll see I made a VI Icon for Replace Filename, which does (I think) a nicer job of self-documenting than showing its Label.  To make the filename, add the correct extension (.xlsx for Excel, .csv for CSV), use Build Path to combine Folder and Filename, and wire to Save Report.
    The next two functions add the Extract Everything and Write to Spreadsheet, using a Comma as a separator, which makes a CSV copy for you.
    Bob Schor

  • CSV file read

    Is there a standard FM which handles csv file read? I am currently using a 'split at' to separate values but this fails when some strings ( within quotes) have commas.
    Eg:
    333,khdfs, "Company name", 87348, " Name1, Name2"
    In this scenerio, the last field in quotes gets split into 2. I cannot handle this in the progrm because the last field does not always have a comma split. Any suggestions?

    Hi Suker ,
    First you remove all the Quotes , then split into coma (,).
    I mean to say --
    REPLACE   ALL   OCCURRENCES OF '"'  IN <string_name> WITH SPACE.
    Now split the string at the coma - -
    SPLIT  AT  ....
    Regards
    Pinaki

  • Load prompt values from Excel or CSV files?

    Hello all,
    We have report and users want to upload filters to prompts on the reports from excel or csv files. They cannot enter one by one because they some times have hundereds of values (customer numbers) to filter. Is there a way to do that? If it is then how is it possible?
    Thanks a lot.

    Hello Zahid,
    It is currently possible to create a relational multi-source universe with one data provider to an Excel document.
    for this to work for Web Intelligence the 62 bit drivers must be installed on the Webi Server for Excel.
    Here is a link to the kbase
    https://service.sap.com/sap/support/notes/1828466
    Also here is a link to the Information Design Tool Guide for how to create a multi-source universe:
    http://service.sap.com/sap/support/notes/1898185
    One of the new features in BI 4.0 is creating a list of values on a Table or custom SQL.
    also, here is the link to the available tutorials:
    Official Product Tutorials – SAP BusinessObjects Business Intelligence Platform 4.x
    Scroll down to the information design tool.
    Hope this helps!
    Jacqueline

  • How to read only particualr columns from excel sheet to internal table

    Hi,
    I have and excel sheet which has around 20 columns, in which i want to read only 6 columns. They are at different column positions, means the 1st column, 6thcolumn, 8th column so on..
    Can we do this in sap? do we have any FM to do this?
    Thanks.
    Praveena.

    hi,
    Use the below logic to fetch the data into internal table..You need to read the data cell by cell and update the internal table,
    DATA l_count TYPE sy-tabix.
       CONSTANTS: lc_begin_col TYPE i VALUE '1',
                  lc_begin_row TYPE i VALUE '2',
                  lc_end_col   TYPE i VALUE '2',
                  lc_end_row   TYPE i VALUE '3000'.
      CLEAR p_i_excel_data. REFRESH p_i_excel_data.
    * Function module to read excel file and convert it into internal table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = p_p_file
           i_begin_col             = lc_begin_col
           i_begin_row             = lc_begin_row
           i_end_col               = lc_end_col
           i_end_row               = lc_end_row
         TABLES
           intern                  = i_data
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
    * Error in file upload
       IF sy-subrc NE 0 .
         MESSAGE text-006 TYPE 'E'.
         EXIT.
       ENDIF.
       IF i_data[] IS INITIAL .
         MESSAGE text-007 TYPE 'E'.
         EXIT.
       ELSE.
         SORT i_data BY row col .
    * Loop to fill data in Internal Table
         LOOP AT i_data .
           MOVE i_data-col TO l_count .
           ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
           MOVE i_data-value TO <fs_source> .
           AT END OF row .
    * Append data into internal table
             APPEND p_i_excel_data.
             CLEAR p_i_excel_data.
           ENDAT .
         ENDLOOP .
       ENDIF .

  • How to make files read only

    I want to make files read only.  Any workaround is welcomed.

    t quinn wrote:
    ElMagoElGato,
    I am glad to give some help but I am still confused because we are having different experiences. I have been able to lock Tables on my mac and have that lock respected in iOS for a long while now. Easy to unlock, impossible to relock.  With the most recent upgrade I can lock tables after tapping the upper left dot to select the whole table and going to "arrange" in the paintbrush.
    When you say worksheet are you meaning the entire file? When you say file lock are you meaning password protection? You can see I am confused.
    quinn
    Based on what ElMagoElGato has described, password protecting would be of no value to him. Once the file is accessed, it is in edit mode. Unless I'm really missing something.
    Files I have imported from Mac iworks apps with elements locked stay locked for me in iOS. Not sure what the problem is.

  • How to generate a second csv file with different report columns selected?

    Hi. Everybody:
    How to generate a second csv file with different report columns selected?
    The first csv file is easy (report attributes -> report export -> enable CSV output Yes). However, our users demand 2 csv files with different report columns selected to meet their different needs.
    (The users don't want to have one csv file with all report columns included. They just want to get whatever they need directly, no extra columns)
    Thank you for any help!
    MZ

    Hello,
    I'm doing it usually. Typically example would be in the report only the column "FIRST_NAME" and "LAST_NAME" displayed whereas
    in the csv exported with the UTL_FILE the complete address (street, housenumber, additions, zip, town, state ... ) is written, these things are needed e.g. the form letters.
    You do not need another page, just an additional button named e.g. "export_to_csv" on your report page.
    The csv export itself is handled from a plsql procedure "stored procedure" ( I like to have business logic outside of apex) which is invoked by pressing the button "export_to_csv". Of course the stored procedure can handle also parameters
    An example code would be something like
    PROCEDURE srn_brief_mitglieder (
         p_start_mg_nr IN NUMBER,
         p_ende_mg_nr IN NUMBER
    AS
    export_file          UTL_FILE.FILE_TYPE;
    l_line               VARCHAR2(20000);
    l_lfd               NUMBER;
    l_dateiname          VARCHAR2(100);
    l_datum               VARCHAR2(20);
    l_hilfe               VARCHAR2(20);
    CURSOR c1 IS
    SELECT
    MG_NR
    ,TO_CHAR(MG_BEITRITT,'dd.mm.yyyy') AS MG_BEITRITT ,TO_CHAR(MG_AUFNAHME,'dd.mm.yyyy') AS MG_AUFNAHME
    ,MG_ANREDE ,MG_TITEL ,MG_NACHNAME ,MG_VORNAME
    ,MG_STRASSE ,MG_HNR ,MG_ZUSATZ ,MG_PLZ ,MG_ORT
    FROM MITGLIEDER
    WHERE MG_NR >= p_start_mg_nr
    AND MG_NR <= p_ende_mg_nr
    --WHERE ROWNUM < 10
    ORDER BY MG_NR;
    BEGIN
    SELECT TO_CHAR(SYSDATE, 'yyyy_mm_dd' ) INTO l_datum FROM DUAL;
    SELECT TO_CHAR(SYSDATE, 'hh24miss' ) INTO l_hilfe FROM DUAL;
    l_datum := l_datum||'_'||l_hilfe;
    --DBMS_OUTPUT.PUT_LINE ( l_datum);
    l_dateiname := 'SRNBRIEF_MITGLIEDER_'||l_datum||'.CSV';
    --DBMS_OUTPUT.PUT_LINE ( l_dateiname);
    export_file := UTL_FILE.FOPEN('EXPORTDIR', l_dateiname, 'W');
    l_line := '';
    --HEADER
    l_line := '"NR"|"BEITRITT"|"AUFNAHME"|"ANREDE"|"TITEL"|"NACHNAME"|"VORNAME"';
    l_line := l_line||'|"STRASSE"|"HNR"|"ZUSATZ"|"PLZ"|"ORT"';
         UTL_FILE.PUT_LINE(export_file, l_line);
    FOR rec IN c1
    LOOP
         l_line :=  '"'||rec.MG_NR||'"';     
         l_line := l_line||'|"'||rec.MG_BEITRITT||'"|"' ||rec.MG_AUFNAHME||'"';
         l_line := l_line||'|"'||rec.MG_ANREDE||'"|"'||rec.MG_TITEL||'"|"'||rec.MG_NACHNAME||'"|"'||rec.MG_VORNAME||'"';     
         l_line := l_line||'|"'||rec.MG_STRASSE||'"|"'||rec.MG_HNR||'"|"'||rec.MG_ZUSATZ||'"|"'||rec.MG_PLZ||'"|"'||rec.MG_ORT||'"';          
    --     DBMS_OUTPUT.PUT_LINE (l_line);
    -- in datei schreiben
         UTL_FILE.PUT_LINE(export_file, l_line);
    END LOOP;
    UTL_FILE.FCLOSE(export_file);
    END srn_brief_mitglieder;Edited by: wucis on Nov 6, 2011 9:09 AM

  • When I open a document from any of my files, it only opens in a small screen and I can't make the screen bigger.

    Hello!  I'm hoping someone can help me with a recent problem on my MacBook Pro.  When I try to open a document from one of my files, it only seems to open in a small screen and I can't seem to make that screen any bigger to work on it.  Has this happened to anyone else before?  Thank you for your answer in advance!

    Oh, I wanted to add that trying to drag the little diagonal lines to the right of the page doesn't seem to work.

Maybe you are looking for

  • Using iPhoto library by two accounts on the same computer

    I have tried to use iPhoto across two accounts on the same computer using the fast switching. I have found that i could access the iPhoto library by opening the app with the option key down and pointing the user to the library in the primary account.

  • Calling a smart form on click of a button in web dynpro abap

    Hi experts, I have a requirement like if I click a button in a view i need ti generate a PDF through smart form. Is this possible. If so please tell me the way.. Thanks & Regards

  • Search help for user field for WBS element

    Hi, how can I add a search help to one of the user fields for WBS elements without modification? Is there an exit which I can use? I want to have a search help for field PRPS-USR02. Thanks for your help.

  • How to make  paging in JSP?

    I would like to know how to make paging in JSP? PLEASE HELP ME !

  • Odd message when copyying to another disk

    I'm trying to copy from one FW drive to another. I tried moving some .mov files but something screwed up, now they're grayed out and when I try to trash them I get the message file in use by another application, but no other application is open. Now