Interview Questions   Tutorials   Discussions   Programs   

Teradata - Tell me a query to find the Primary key, Foreign key, primary Index,PPI for the Database?




2024
views
asked mar September 20, 2014 06:38 AM  

Tell me a query to find the Primary key, Foreign key, primary Index,PPI for the Database?


           

1 Answers



 
answered By vishnoiprem   0  
Select DatabaseName, TableName ,columnName,

Case
When IndexType='K' Then 'Primary Key'
When IndexType='S' Then 'Secondary Index'
When IndexType='P' Then 'Primary Index'
When IndexType='Q' Then 'PPIndex'
When IndexType='J' Then 'Join Index'
End    as implimented_Index
From DBC.Indices
Where TableName in

( Select distinct TableName
From DBC.Tablesize
Where DatabaseName <>'DBC'
And
CurrentPerm>0
)
Order by 1,2,3
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert