how to export the reusult of a query to a comma delimited data file?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: how to export the reusult of a query to a comma delimited data file?

Hybrid View

  1. #1
    Join Date
    Jan 2001
    Posts
    59

    how to export the reusult of a query to a comma delimited data file? can anyone give me an example? It would be better if the output file has the table column names in the first row.

    thanks.

  2. #2
    Join Date
    Aug 2000
    Posts
    462
    set echo on
    spool &where_to_put_this_output;

    select field1||', '||field2||', '||field3 from mytable;

    spool off;

  3. #3
    Join Date
    Feb 2001
    Posts
    203
    kmesser,
    I am adding one more line to your code

    set heading off
    set echo on
    spool &where_to_put_this_output;

    select field1||', '||field2||', '||field3 from mytable;

    spool off;
    sree

  4. #4
    Join Date
    May 2001
    Location
    San Francisco, California
    Posts
    510
    I would also add:

    set feedback off


  5. #5
    Join Date
    Feb 2001
    Posts
    123
    If we are going for the set, and substitution variables are used in the code, then

    SET VERIFY OFF

    might also be useful.

    HTH

    David.

  6. #6
    Join Date
    May 2000
    Posts
    58
    You can also use
    SET COLSEP ,
    if you have lots of columns to concatenate using ||

  7. #7
    Join Date
    Mar 2001
    Posts
    52
    The query will be faster if
    SET TERMOUT OFF

Posting Permissions

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


Click Here to Expand Forum to Full Width