sql - How to output a file using tab delimiter in Netezza NZSQL -


i trying output files using nzsql cli not able output tab delimited files. can has worked on nz share thoughts on below command.

tried far :-

nzsql  -o sample.txt -f=  -a -t -c  "select * dw_etl.user datasliceid % 20 = 2 limit 5;" 

to specify tab delimiter use $ in conjunction -f option.

nzsql  -o sample.txt -f $'\t'  -a -t -c  "select * dw_etl.user datasliceid % 20 = 2 limit 5;" 

this documented in nzsql -h output.

nzsql -h nzsql, ibm netezza sql interactive terminal.  usage:   nzsql [options] [security options] [dbname [username] [password]]  security options:   -securitylevel       security level wish request (default: preferredunsecured)   -cacertfile          root ca certificate file (default: null)  options:   -a                   echo input script   -a                   unaligned table output mode (-p format=unaligned)   -c <query>           run single query (or slash command) , exit   -d <dbname>          specify database name connect (default: system)   -d <dbname>          specify database name connect (default: system)   -schema <schemaname> specify schema name connect (default: $nz_schema)   -e                   echo queries sent backend   -e                   display queries internal commands generate   -f <filename>        execute queries file, exit   -f <string>          set field separator (default: "|") (-p fieldsep=)                        binary/control/non-printable character use '$'                        (e.g., nzsql -f $'\t' // tab) ... 

if have lot of data, i'd recommend using external tables instead perform better.

create external table '/tmp/sample.txt' using (delimiter '\t')  select * dw_etl.user datasliceid % 20 = 2 limit 5; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -