Search found 71 matches

by dbmsuser7
Thu Jul 17, 2014 1:47 pm
Forum: New to Vertica SQL
Topic: SQL formatter or prettyfier?
Replies: 4
Views: 54311

Re: SQL formatter or prettyfier?

Thanks for your reply.

In what ways does "Instant SQL Formatter" fall short?
by dbmsuser7
Tue Jul 15, 2014 1:48 pm
Forum: New to Vertica SQL
Topic: SQL formatter or prettyfier?
Replies: 4
Views: 54311

SQL formatter or prettyfier?

Anyone know of a program which will take SQL code and format it nicely, which works with SQL written for Vertica?

I imagine there are some generic formatters but I'm not sure whether they'd leave the code intact.
by dbmsuser7
Sat Apr 26, 2014 12:59 am
Forum: Vertica SQL
Topic: Cast INTEGER to INTERVAL (seconds)
Replies: 2
Views: 12720

Re: Cast INTEGER to INTERVAL (seconds)

Thanks, sKwa! You are teh awesome! Just for my own notes: vertica=> SELECT CAST(172 AS INTERVAL SECOND) - CAST(172::VARCHAR || ' s' AS INTERVAL) AS diff; diff ------ 0 (1 row) Kind of silly of me...I think I read the documention too zealously; they're very restrictive on what casts are allowed, even...
by dbmsuser7
Fri Apr 25, 2014 8:35 pm
Forum: Vertica SQL
Topic: Cast INTEGER to INTERVAL (seconds)
Replies: 2
Views: 12720

Cast INTEGER to INTERVAL (seconds)

Right now I do this as

Code: Select all

CAST(my_integer::VARCHAR || ' s' AS INTERVAL)
Is there a less klunky way of doing it?
by dbmsuser7
Tue Apr 15, 2014 2:44 pm
Forum: Vertica SQL
Topic: Randomly pick rows from table
Replies: 2
Views: 8438

Re: Randomly pick rows from table

I have no, but book Sql Antipatterns does. OK...seems like what he didn't like about it was that it doesn't scale well. I'm only doing some spot-checking, so scaling isn't really a concern for me. May be this thread will interest you too: Selecting a Random Set of Rows from a Table I'll check that ...
by dbmsuser7
Mon Apr 14, 2014 6:56 pm
Forum: Vertica SQL
Topic: Randomly pick rows from table
Replies: 2
Views: 8438

Randomly pick rows from table

How can one randomly pick rows from a table? A stackoverflow thread ( http://stackoverflow.com/questions/580639/how-to-randomly-select-rows-in-sql ) suggests SELECT column FROM table ORDER BY RANDOM() LIMIT 1 in the case of one row, for PostgreSQL. The same code seems to work in Vertica, though I do...
by dbmsuser7
Mon Apr 14, 2014 6:54 pm
Forum: Vertica SQL
Topic: display data type of an expression?
Replies: 6
Views: 10891

Re: display data type of an expression?

sKwa wrote:And how about function overloading?
Yeah, that seems like a handy trick. I'll try that soon.

Go to advanced search