Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Wed, 16 Feb 2005 @ 17:00:20 GMT


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


Subj:   Re: Procedure Problem.
 
From:   Muthusamy, Sudha

Babu

"I am trying to generate Mload script for the given staging table, for that I need to get all the columns and data types and so on, that's the reason I selecting that particular table values and going to read one by one to place some where in the form of layout which is in mload."

Here with I am sending you a BTEQ script that can perform the same functionality of your procedure

The field load_script contains the value of columnname, COLUMNTYPE,COLUMNLENGTH etc..

Let me know if you need more clarification


Thanks

Sudha


Here is the sample values in the table

     databasename   tablename   load_script
     --------------------------------------------------------------------------
     UD202          mytblname   select databasename,CV,30 from UD202.mytblname;
     UD202          mytblname   select tablename,CV,30 from UD202.mytblname;
     UD202          mytblname   select load_script,CV,300 from UD202.mytblname;


     /*********************** forum.btq script ***********************/
     bteq << EOF

     .set session transaction btet;

     .run file=${HOME}/.tdlogon
     .set maxerror 99
     .set width 254
     drop table ud202.mytblname;

     .set maxerror 1
     Create multiset table ud202.mytblname
     (databasename varchar(30),
     tablename     varchar(30),
     load_script   varchar(300)
     )
     ;

     .os rm forum.lst
     .export report file=forum.lst

     select
     'insert into ud202.mytblname select '''

     || trim(both from C.databasename) ||''','''
     || trim(both from C.tablename) ||''',''select '
     || trim(both from c.columnname) ||','
     || trim(both from c.COLUMNTYPE)|| ','
     || trim(both from c.COLUMNLENGTH)
     ||' from '|| trim(both from C.databasename)||'.'|| trim(both from C.tablename)
     ||';'' ;' (title'')

     From dbc.columns c  /* you can pass your tablename if you want to run
     the script the script for multiple values and change the where clause */
     where c.databasename = 'ud202'
     and c.tablename      = 'mytblname'
     ;

     .export reset
     .run file=forum.lst
     .quit
     EOF


     
  <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: 28 Jun 2020