Search code examples
teradatateradatasql

How to find the total number of columns in a table in teradata?


I am trying to get the number of columns in a row for a given table in teradata. I am finding it difficult to find the total number with the usual SQL command. This is what I have tried but did not give me any result:

SELECT COUNT(*)
  FROM INFORMATION_SCHEMA.COLUMNS
 WHERE table_catalog = 'WMS' 
   AND table_name = 'RM_SELLER_ITEM_MST'

Solution

  • INFORMATION_SCHEMA is not implemented in Teradata, the DBC database holds metadata:

    SELECT COUNT(*)
      FROM dbc.ColumnsV
     WHERE DatabaseName = 'WMS' 
       AND TableName = 'RM_SELLER_ITEM_MST'