Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 21 Apr 2003 @ 21:59:57 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Select * from mytable
 
From:   Michael Larkins

Hi All:

I hope everyone experienced a joy filled Easter.

The SAMPLE suggestion would absolutely return only 2000 rows. However, as mentioned, they are randomly selected. Not only that, but historically this function has been very slow, requiring all rows to be in SPOOL for the random selection to be implemented.

The original posting indicated, "The astute user wants to look at the first 2000 rows..."

So, I might suggest the RANK function. It can be set up with the QUALIFY to return the first 2000 rows in the sequence of the value(s) by the "Primary Key" and/or Primary Index in Teradata.

Try something like this:

Locking MyTable for access
Select * from MyTable
QUALIFY RANK(PI_column_name ASC) <= 2000 ;
/* remember that RANK defaults to DESC */


Hope this helps.

Mike



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016