How to get column count from a table in teradata?

Member

by orpha , in category: MySQL , 5 months ago

How to get column count from a table in teradata?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by ryan.murray , 5 months ago

@orpha 

To get the column count from a table in Teradata, you can use the following SQL query:

1
2
3
4
5
6
7
SELECT 
    COUNT(*) AS column_count
FROM
    dbc.ColumnsV
WHERE
    DatabaseName = 'your_database_name'
    AND TableName = 'your_table_name';


Replace 'your_database_name' with the name of the database where your table is located and 'your_table_name' with the name of the table you want to get the column count for.


This query will return the total number of columns in the specified table.

Related Threads:

How to count the number of times an element appears consecutively in a table in teradata?
How to duplicate table row based on column value in teradata?
How to get the table size in teradata?
How to group time column into 5 second intervals and count rows using presto?
How to get maximum column values across a row in teradata sql?
How to get the total size in bytes for a particular table in teradata?