Creating Teradata table in the Datastage job

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
anandkumar442
Participant
Posts: 29
Joined: Tue Feb 16, 2010 8:47 am

Creating Teradata table in the Datastage job

Post by anandkumar442 »

Hi All,

My requirement is to design a job which would create a table (teradata) by itself and should get loaded from the input file.

File ------- transformer --------- TD table.

The TD table will not exists in the DB, we need to create in the job itself.

Could any one help in this, as I am new to TD stages.

Thanks,
Anand
sagar.skhtt@gmail.com
Participant
Posts: 2
Joined: Mon Jan 17, 2011 11:22 pm

Re: Creating Teradata table in the Datastage job

Post by sagar.skhtt@gmail.com »

Hi Anand,
Please use TeradataPX stage in General tab Create table aection put Generate DDL and Drop table action put Generate DDL . this will work each run Drop the table and Create it.

Regards,
Sagar.
anandkumar442
Participant
Posts: 29
Joined: Tue Feb 16, 2010 8:47 am

Re: Creating Teradata table in the Datastage job

Post by anandkumar442 »

Hi Sagar,

Thanks for your reply.

We only have two stages in Teradata. they are
Teradata enterprize
Teradata multiload.

I am not sure about the Teradata Px stage.

Please suggest.

Thanks,
Anand
sagar.skhtt@gmail.com
Participant
Posts: 2
Joined: Mon Jan 17, 2011 11:22 pm

Re: Creating Teradata table in the Datastage job

Post by sagar.skhtt@gmail.com »

Hi Anand,
in Mload Script tab -> Before use this syntax
DROP TABLE database.TableName;
CREATE TABLE database.TableName (
ID DECIMAL(12,0) NOT NULL,
NAME CHAR(5) NOT NULL,
)
PRIMARY INDEX (Keycolumns);


Regards,
Sagar.
anandkumar442
Participant
Posts: 29
Joined: Tue Feb 16, 2010 8:47 am

Re: Creating Teradata table in the Datastage job

Post by anandkumar442 »

Hi Sagar,

Job is finishing successfully.
But the table is not getting created.

Any idea? not warning is there in the job as well

Thanks,
Anand.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: You two need to learn to use the Reply to topic button rather than always quoting everything. I just had to go and clean up the mess this thread was, each reply getting bigger and bigger... sheesh.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Creating Teradata table in the Datastage job

Post by chulett »

anandkumar442 wrote:My requirement is to design a job which would create a table (teradata) by itself and should get loaded from the input file.
Clarify your requirement, please. Do you need to create this table once (the first run only) or is it ok to drop and recreate it each run? The advice you are getting is for the latter solution, just wanted to double-check.

The former is a tougher nut to crack.

And I don't really see how the job can be "finishing successfully" if the table is not getting created. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
anandkumar442
Participant
Posts: 29
Joined: Tue Feb 16, 2010 8:47 am

Post by anandkumar442 »

Hi Chulett,

My apologies for the above replies.

Yes, the requirement is to drop and recreate the table for each and every run.We actually were able to create a table and load it from the file, using the 'Teradata Enterprise stage'.

Now, we would like to get some advice, to drop and recreate the teradata table for each and every run of the job.

Note: We do not want to use Teradata Multiload stage.

Thanks,
Anand.
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Post by RAJARP »

Hi,
I do not know, if i am missing something.

But why can't we simply use a write mode 'Replace' option in Teradata enterprise stage.'Replace' would drop a table and create new one.


Regards,
Raja R P
anandkumar442
Participant
Posts: 29
Joined: Tue Feb 16, 2010 8:47 am

Post by anandkumar442 »

Thanks a lot All.

I am able to create the table and truncate it for each and every run by using the Replace option.

Thank You.

Thanks,
Anand.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just to be anal, from what Raja posted that 'Replace' option drops and recreates the table in question, it is not being truncated. One would do one or the other, not a combination of the two. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply