Creating Table DDL Dynamically from DataStage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
horserider
Participant
Posts: 71
Joined: Mon Jul 09, 2007 1:12 pm

Creating Table DDL Dynamically from DataStage

Post by horserider »

I have a sequential file as a source that has over 150 columns. I have to read the file and dump the data to a teradata table.

(1) Either I first create the table using CREATE TABLE command outside
Datastage manually, then import the metadata and then use it
as a target.

OR

(2) Is there any other way, I can create the table Definition dynamically
using Datastage? I dont want to type CREATE TABLE (all column name
and type) manually.

It would be nice if I can read the source and dump it to a TEMP table,
them make the TEMP table a persistent table and just get the DDL.

Any thoughts?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search the forum for a routine that dumps a table definition. One of the available formats is a CREATE TABLE statement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajaobj
Participant
Posts: 2
Joined: Tue Feb 13, 2007 5:57 am

Creating Table DDL Dynamically from DataStage

Post by rajaobj »

Hi,
Is anybody got the solution for this issue.

Thanks,
Raja
Thanks
Raja
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajaobj
Participant
Posts: 2
Joined: Tue Feb 13, 2007 5:57 am

Creating Table DDL Dynamically from DataStage

Post by rajaobj »

I tried searching for the post but i could not able to locate it,can you please provide me a link for the post.

Thanks,
Raja
Thanks
Raja
shamshad
Premium Member
Premium Member
Posts: 147
Joined: Wed Aug 25, 2004 1:39 pm
Location: Detroit,MI

Post by shamshad »

The way I do is,

First dump all the Columns I need in a text file. So, now I have all the metadata I need for the table. Then, from the same transformer that feeds the text file, I take 1 more link and connect to a teradata Table Stage (Enterprise, API) [if one is using teradata]

On the Table properties, we have a option to append/replace/create table etc. Select the option that will first create the table and then load the data.

When the ETL is first run, it will first create the table and then insert the data. Once the ETL is complete, go to Database Query Tool (such as queryman), select that newly created table, get the table definition and make appropriate changes needed.

Then create the table outside datastage. Remember to change the load option in the ETL. Now, it should NOT be dropped and created every time [if that is what you want], simple select append, replace or appropriate load option.

Hope that helps.
Post Reply