Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006

    Unanswered: insert each csv file into their respective table (was "newbie need help")

    HI all,

    I am very new to db. so pardon me for some stupid questions.

    I have 3 tables Table1, Table2, and table3.
    Table1 and table2 has 5 columns each and table3 has 4 columns.
    i have 6 or 7 csv files (these number of files can change) uploaded to a upload directory.
    these csv filename contains name of the table. for example table1_ab.csv, table1_cd.csv, table2_ef.csv, table2_gh.csv, table3.aa.csv, table3_bb.csv.

    a person goes to a web page and clicks a button.
    This is what the button should do.
    1) Check how many files are there in the upload directory.
    2) use bulk insert to individually insert each csv file into their respective table (the name of the table is in file name).
    3) Copy the csv file into backup directory and delete the file from upload directory.

    I am using any help would me much appriciated.


  2. #2
    Join Date
    Jun 2003
    what u expecting? Sql sever or to create an application to do the job?
    My suggest is,
    to create an application which handle ur requirment rather than everything rely on sql server to do the job.
    Check in net.there are some project which matches ur requirment. specially in
    I love cursor,though I never use it.Cos' I dont want to misuse it.


  3. #3
    Join Date
    Feb 2006
    Thanks mallier for pointing me to codeproject.
    i will go there to try to find my answers.

    Obviously i didnt make myself clear. So here I try again.
    Points 1) and 3) would be handeled by a web application (the vb code)
    for point 2) i want to write a stored procedure which will be called by the web application giving the path of csv file and table name (derived from csv filename).
    This stored procedure should be able to handle all three tables.
    what i need is the code for stored procedure with table name and full file path as variables.

    Also if there is any other way of achieving the same. some sample code would be of great help.

    I hope this time i got my questions write.
    Last edited by tingu; 04-26-06 at 02:08.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts