All Forums Database
sauumar 2 posts Joined 03/13
14 Oct 2013
CREATE INSERT STATEMENTS FOR ALL THE TABLES IN A PARTICULAR DATABASE

Hi All,
I am new to Teradata and I have a query to all the Masters(Guru)here.
Is it possible to generate an Insert Statements for all the Tables and Views existing in a particular Database from the DBC?Please let me know the query if possible.
For e.g. I have 10 Tables/Views in a 'XYZ' Database. All the tables/Views are having some Data. I need Insert Statements for all these Tables/Views at one go so that I can preserve this metadata into ClearCase /RTC for loading it into Future.Please let me know if I havent expressed the question clearly.
It should be something like :
INSERT INTO TABLE1 (COL1,COL2...) VALUES (1,2,3,..);
INSERT INTO TABLE1 (COL1,COL2...) VALUES (4,5,6,..);
INSERT INTO TABLE1 (COL1,COL2...) VALUES (8,5,3,..);
INSERT INTO TABLE2 (COL1,COL2...) VALUES (1,35,4,..);
INSERT INTO TABLE3 (COL1,COL2...) VALUES (3,15,2,..);
.......
INSERT INTO TABLE10 (COL1,COL2...) VALUES (3,15,2,..);
Any help would be really appreciable!!!!

SaurabhK
Adharssh 36 posts Joined 08/13
15 Oct 2013

Hi,
You can use the following DBC Table.

sel * from dbc.DBQLSqlTbl where sql_text_info like '%TABLE1%' ; 

The following query will give out the SQL's performed for the TABLE1. It will include the SELECT,INSERT,CREATE,etc.
 
Thanks & Regards,
Adharssh Hospet Srinivasa Rao.

Share the Knowledge. Feel the Happiness, When you share/Teach it.

You must sign in to leave a comment.