SET NOCOUNT equivalent in Vertica

Moderator: NorbertKrupa

Post Reply
User avatar
fsalvelt
Intermediate
Intermediate
Posts: 54
Joined: Sun Mar 18, 2012 1:34 am

SET NOCOUNT equivalent in Vertica

Post by fsalvelt » Fri Dec 14, 2012 1:29 pm

Hey,

Is there a feature available in Vertica when writing scripts that is similar to the SET NOCOUNT command in SQL Server which will stop the message indicating the number of rows affected by a Transact-SQL statement from being returned as part of the results.

Thank you!
Thank, Fred

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: SET NOCOUNT equivalent in Vertica

Post by id10t » Fri Dec 14, 2012 1:57 pm

Hi!

Do you want standard output without last row where rows counted, but with a fist row with columns names?

User avatar
fsalvelt
Intermediate
Intermediate
Posts: 54
Joined: Sun Mar 18, 2012 1:34 am

Re: SET NOCOUNT equivilent in Vertica

Post by fsalvelt » Fri Dec 14, 2012 2:12 pm

Hey,

I would just like the output to not have the row count.

So for a simple statement like "select count(*) from dual;" I would like to get back just:

count
-------
1

... not this:

count
-------
1
(1 row)

Thanks for the quick response, btw!
Thank, Fred

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: SET NOCOUNT equivalent in Vertica

Post by id10t » Fri Dec 14, 2012 3:19 pm

Hi!

vsql has no such ability/option (it vsql issue, not Vertica). If you don't need header so try option "tuples only" (`\t` - inside of script or `-t` as command line arg).
Do you will accept workarounds?

User avatar
fsalvelt
Intermediate
Intermediate
Posts: 54
Joined: Sun Mar 18, 2012 1:34 am

Re: SET NOCOUNT equivilent in Vertica

Post by fsalvelt » Fri Dec 14, 2012 4:41 pm

Hi sKwa,

Sure, I'm willing to use a work around :)

I wonder if Vertica plans on adding an option to vsql in the future for this?

Thanks!!!
Thank, Fred

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: SET NOCOUNT equivalent in Vertica

Post by id10t » Fri Dec 14, 2012 7:29 pm

Hi!

Sorry I was wrong. No work around - direct solution: variable FOOTER
  • From shell:

    Code: Select all

    [ ~ ]$ vsql -P footer=off -c "select * from nums limit 5"
     id 
    ----
      1
      2
      3
      4
      5
    
  • From vsql or script:

    Code: Select all

    dbadmin=> \pset footer off
    Default footer is off.
    dbadmin=> select * from nums limit 5; 
     id 
    ----
      1
      2
      3
      4
      5
    
    dbadmin=> 
    

User avatar
fsalvelt
Intermediate
Intermediate
Posts: 54
Joined: Sun Mar 18, 2012 1:34 am

Re: SET NOCOUNT equivalent in Vertica

Post by fsalvelt » Fri Dec 14, 2012 7:37 pm

That's perfect!!! You're brilliant, sKwa! Thanks, man!
Thank, Fred

Post Reply

Return to “New to Vertica Database Development”