Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 01 May 2007 @ 14:38:07 GMT


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


Subj:   Re: Using a Macro to create the mload Script
 
From:   Barry Hull

You can generate it much easier by loading a template into a table with sequence numbers. In the template, you put keywords to represent where you want something replaced with a databasename, table/view name, or list of column names. Since you have different types of column lists, you may have a different keyword for each.

Then, you create a macro that takes in the databasename, table/view name, and any other parameters that you want to pass in. The macro can join the template table to the dbc.columns and then generate the code for you. By using a template, you're not coding every line in the macro...instead, the macro is just reacting to the keywords in the template.

Whether or not you want to do this (it is a little bit of work to set it up) will depend on how many scripts you'll be able to create using this approach. I have used this approach at a customer site and have literally been able to generate some of the TPT (Teradata Parallel Transporter) scripts and run them without any additional customization. In my case, we had to do about 80 load scripts. The script would be generated in about 20 seconds and then I would just look through it to see if we had any specific customizations to apply.

This may not be worth it if you're going to do 10 scripts or less. But as the number of load scripts that you are going to be doing increases, it becomes more worthwhile.

Now that I've built a base generator, I sometimes do as Glenn suggests if the script that I need does match what is generated...I'll generate the code and then cut/paste pieces of it into Ultraedit and then complete it from there.

So, to each his own, but I found in my case that the generator was worthwhile...


Barry



     
  <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