We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


tab delimited output with vsql on windows ? — Vertica Forum

tab delimited output with vsql on windows ?

This is driving me nuts today. How do you set the delimiter to tab when spooling out to a file with vsql on windows ? I've tried giving all sorts of values to the -F option but can't get it to work. vsql is interpreting the what I give as literals e.g. if I give -F /t it makes the delimiter in the outout /t, -F '/t' makes it '/t' and -F E'\t'.
Any clue ?
Thanks
Dave

Comments

  • Hi. I don't know if this will help, and I recently spoke with the team that works on vSQL. Some of the behavior of vSQL is determined by the tecla library (see http://www.astro.caltech.edu/~mcs/tecla/) Take a look and see if it helps. I'd love to know what you find out. Additionally, perhaps there's a different answer regarding the behavior you're experiencing. I can ask, if you like.

  • Jim_KnicelyJim_Knicely - Select Field - Administrator

    I think you can do it like this:

    [dbadmin@s18384357 ~]$ vsql -Atc "SELECT * FROM jim;"
    val1|val2
    
    [dbadmin@s18384357 ~]$ vsql -F $'\t' -Atc "SELECT * FROM jim;"
    val1    val2
    
  • Jim_KnicelyJim_Knicely - Select Field - Administrator
    edited July 2017

    Sorry, I see now that you were asking about Windows.

    Here is how you can do it there:

    C:\Program Files\Vertica Systems\VSQL64>vsql -h verticademos.com -U dbadmin -Atc "select * from jim;"
    val1|val2
    

    First, switch off the "tab" auto complete:

    C:\Program Files\Vertica Systems\VSQL64>cmd /f
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    

    Now I can use the TAB key as a value for the delimiter:

    C:\Program Files\Vertica Systems\VSQL64>vsql -F "[tab]" -h verticademos.com -U dbadmin -Atc "select * from jim;"
    val1    val2
    

    Note that [tab] was me actually hitting the tab key...

    Or you can create a variable that hold the tab:

    C:\Program Files\Vertica Systems\VSQL64>set tab=[tab]
    
    C:\Program Files\Vertica Systems\VSQL64>vsql -F "%tab%" -h verticademos.com -U dbadmin -Atc "select * from jim;"
    val1    val2
    

    Again, [tab] was me actually hitting the tab key...

  • edited September 2017

    I found that the order in the command line makes a difference. I'm on Win 7 64-bit/VSQL64 8.1 and had to move the -F "[tab]" to the end of the line to keep vsql/Windows from complaining and ignoring everything in the line after the -F "[tab]"

  • gzzzgzzz Vertica Customer

    After seven years there is still no way to pass the separator in the windows command-line?..

  • Bryan_HBryan_H Vertica Employee Administrator

    A workaround example: Create the following "test.sql" file:
    \pset fieldsep '\t'
    select * from nodes;
    Then run: .\vsql.exe -h 192.168.1.1 -U dbadmin -w password -Atf .\test.sql

Leave a Comment

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