All Forums Database
NewbieTD 25 posts Joined 05/13
27 Jul 2016
Need to get View Column derivation info from teradata

Hi All,
I want to get all view columns derviation/definition information. Is there any way to get them.
eg:
my table name is - DB.ORG_Table
which has 3 columns namely col1,col2,col3
i have created view (Myview) as "repalce view DBV.Myview as locking table DB.ORG_Table access select col1 as id,(col2/col3)*100 as Cal_Val from DB.ORG_Table".
Now i want myview column information like below:
id - DB.ORG_Table.Col1
Cal_Val - (DB.ORG_Table.Col2/DB.ORG_Table.Col3)*100
 
Thanks in advance.
 
Thanks....

M.Saeed Khurram 544 posts Joined 09/12
27 Jul 2016

I dont see much difference what you already have, except you want to use table name with column names.
You can use the table alias for that as follows:

repalce view DBV.Myview as locking table DB.ORG_Table for access 
select OT.col1 as id,(OT.col2/OT.col3)*100 as Cal_Val 
from DB.ORG_Table AS OT

 

Khurram

NewbieTD 25 posts Joined 05/13
27 Jul 2016

Hi Saeed,
Thanks for your info,
 
i want know from which table Cal_val is coming.
i dont want to use help or show view statement.
Is there any way??
 
Thanks,
 

M.Saeed Khurram 544 posts Joined 09/12
27 Jul 2016

You will have to show the view definition to get the source of Cal_Val.
If you need this info to automate something, you can use show view, extract tablename in some variable and use that variable in your script.

Khurram

You must sign in to leave a comment.