How to get the statement used to updated/populate a table

Database
Enthusiast

How to get the statement used to updated/populate a table

Hi,

Is there a way I can check how the table has been updated.

I mean I can get the DDL by using "Show table database.Tablename" but what I want to know is what was the select statement that was used to updated the table.

Is there a way to get that ?

Thanks!

2 REPLIES
Teradata Employee

Re: How to get the statement used to updated/populate a table

Check on dbc.Dbqlogtbl the queries that occured on your table. ( column  querytext like '%Tablename%' )

Junior Supporter

Re: How to get the statement used to updated/populate a table

Join pdcrinfo.Dbqlogtbl_hst and  pdcrinfo.Dbqsqltbl_hst on query id, proc id and logdate. And put a filter in querytext like '%tablename%'. This column is present in pdcrinfo.Dbqsqltbl_hst. Use this version if the query is run a day before you want to check. If you want to check for the same day, use the DBC version of the tables.

--Samir