CREATE INSERT STATEMENTS FOR ALL THE TABLES IN A PARTICULAR DATABASE

Database

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!!!!

1 REPLY
Enthusiast

Re: CREATE INSERT STATEMENTS FOR ALL THE TABLES IN A PARTICULAR DATABASE

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.