Does Teradata have global parameters or global variables? I want to take a sample from a table where the sample size is a multiple of the number of rows in another, existing, table:
create table t2 AS(
select top 360 *
with data primary index(keycol)
Where table t1 exists and has 120 rows. But I do not want to hard code it in case t1 changes and has a different number of rows in a later run.
Can it be done?
You need a Stored Procedure using Dynamic SQL, Teradata simly doesn't allow a variable for TOP or SAMPLE.