Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2015
    Posts
    1

    Unanswered: DB2 : export of a select into a file

    Hello,

    I would like to do an export of a select into a file, I executed the following query on a linux server directly via a Putty session (SSH), I can export the data into a file without any problem.


    Code:
    export to /my/path/test.txt of del select * from mytable

    When i'm using this same query in the IBM Data Studio (Version 4.1.1), I received this error :


    An unexpected token "export to my/path/test.txt" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<from>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.18.60
    What's wrong ? How can I do ?

    Thanks,

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    export will be executed locally .. if windows machine c:\xxxx
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hello,

    EXPORT is not an SQL statement, it's a command.
    If you want to export the results to the server's side, use the admin_cmd procedure with export command text.
    If you want to export the results to the client's side, try this:
    Exporting results from the SQL Results view to a file
    Regards,
    Mark.

Posting Permissions

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