Loading data from table to file

i need to load data from a table to csv but with in a single command i need to acheive this . so please suggest me an way to do this using vsql command. Thanks

Comments

  • Hii Harish, You can do it by using \o command. Eg: i have a table named TEST_TABLE now i want to generate a comma separated data from this table. for that do as follows.. \o /home/dbadmin/TEST_TABLE.txt; select * from TEST_TABLE; DONE!! Now search the file in the path /home/dbadmin Regards, Raj!!!
  • Harish, Prior to the above statements, you need to do some file alignment settings. \a for alignment \f for separator Eg: comma, pipe, tab Regards, Raj
  • Prasanta_PalPrasanta_Pal - Select Field - Employee
    From unix prompt $/opt/vertica/bin/vsql -U dbadmin -A -t -F'|' -h -c "select * from " > /tmp/export.txt
  • but for the dbadmin it will be asking for password i want the password also encrypted in the same command.

    > vsql -U username -F $'\t' -At -o dumpfile.txt -c "SELECT * FROM my_table;"
    Password:
    i want to enter the password also in the same command.
    My scenario this command fires on vertica db through a jdbc driver. for that i am writing a shell script to open vsql and fire this query and come out of vsql

  • Navin_CNavin_C Vertica Customer
    use this from unix terminal
    vsql -U username -w password -F $'\t' -At -o dumpfile.txt -c "SELECT * FROM my_table;"
    Hope this helps.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file