Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 29 Jul 2002 @ 20:18:48 GMT


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


Subj:   Macro Possibilities?
 
From:   Jason Fortenberry

Hello All,

Is it possible using macros to pass in a table name as a parameter for use in a FROM clause?

During my ETL process I need to insert into a single table from multiple different source tables. These source tables are created by separate, unique ETL process that do not communicate between themselves, so a union type operation is not really an option here. But I was hoping that a single macro could be created and passed in the source table name as a parameter and thus allow me to only maintain one instance of the insert statement.

The macro code I was trying to run is:

CREATE MACRO DB.Insert_Macro(
Source_Table VARCHAR(30)
)
AS(
Insert into DB.Target_Table
Select
col1, col2
From :Source_Table;
);

I receive the following error message:

Code = 3707.
3707: Syntax error, expected something like a name between the 'From' keyword and ':'.

I am not very familiar with macros and am hoping to be missing something simple. But it appears the SQL code is being parsed at macro creation time instead of at macro execution time. Is this a correct understanding? Does anyone have a work around? Could stored procedures offer a solution (though I tried to with no luck)?


Thanks for any help!

--Jason



     
  <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: 15 Jun 2023