DataAnalyst
Technical User
Hi,
1. Can anyone please suggest a way setup automated scripts to create tables (thru BTEQ script/macro or whatever) that have datestamp in their names?
Example:
This week the script should create TableName_20021110.
Next week it should create TableName_20021117 etc.
Both the following are not being accepted:
/** #1 Create using macro **/
Create Macro Test_Macro1_M (tabName Varchar(30))
As (Create Table :tabName (Col1 Decimal(16));
/** #2 Create and rename **/
Create Macro Test_Macro2_M (tabName Varchar(30))
As (Rename Table Old_Name To :tabName;
One option that struck me to accomplish this is to generate the create statement dynamically in a file and run the file.
Example: Export this result to a file and run the file: "Select 'Create table tab'||<datestamp>||'(...);';
But in this method, req#2 below will be very complicated.
2. After creating the table, I need to populate the table and also run a bunch of automated select queries against it.
So in "Select * From TableName_20021110", after the FROM, the name should automatically be the above created table name.
Too much to ask for?
Thanks for you time.
1. Can anyone please suggest a way setup automated scripts to create tables (thru BTEQ script/macro or whatever) that have datestamp in their names?
Example:
This week the script should create TableName_20021110.
Next week it should create TableName_20021117 etc.
Both the following are not being accepted:
/** #1 Create using macro **/
Create Macro Test_Macro1_M (tabName Varchar(30))
As (Create Table :tabName (Col1 Decimal(16));
/** #2 Create and rename **/
Create Macro Test_Macro2_M (tabName Varchar(30))
As (Rename Table Old_Name To :tabName;
One option that struck me to accomplish this is to generate the create statement dynamically in a file and run the file.
Example: Export this result to a file and run the file: "Select 'Create table tab'||<datestamp>||'(...);';
But in this method, req#2 below will be very complicated.
2. After creating the table, I need to populate the table and also run a bunch of automated select queries against it.
So in "Select * From TableName_20021110", after the FROM, the name should automatically be the above created table name.
Too much to ask for?
Thanks for you time.