Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2014
    Posts
    21

    Unanswered: combine two QUERIES - DELETE and IMPORT

    Hi,

    I have a VBA code that executes SQL command for importing CSV. But first I want to delete all records from a table, and then import CSV.

    Here's my code (not working):

    Code:
    QRYSTR = "Call SYSPROC.ADMIN_CMD ('DELETE FROM db2admin.razpored' ; 'IMPORT FROM C:\Users\db2admin.Luka-PC\Documents\auth.csv OF DEL INSERT INTO db2admin.razpored')"
    Coloured line is where both queries should go. Now It doesn't do nothing. Tried with : "AND",";","TRUNCATE TABLE db2admin.razpored IMMEDIATE"

    SQL is not my territory, maybe someone has any suggestion ?

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I think may be it's about time you try to make SQL your territory and start reading manuals? E.g. about the REPLACE option of the IMPORT command? Or the allowed syntax for ADMIN_CMD() parameters?
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Oct 2014
    Posts
    21
    Thanks, I'll look into that. Don't be angry, I'm just a student and need all this for school project, my occupation is otherwise a completely non-computer environment.

    And I'm in a little bit of rush, so It's kind of neccessary to look for help on forums, especially If a lot of areas needed for job done (VBA,Java, PHP, Db2 and Sql).

    About reading manuals...This DB2 "manuals" are not quite educating-friendly and are easy-understandable to DBA's with some experiences - and I say that from my experience, because I learned a lot of different programming languages.

  4. #4
    Join Date
    Oct 2014
    Posts
    21
    Oh, I forgot to post correct syntax :

    IMPORT FROM C:\Users\db2admin.Luka-PC\Documents\auth.csv OF DEL REPLACE INTO db2admin.razpored')

Posting Permissions

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