All Forums UDA
altruist 4 posts Joined 06/09
30 Jul 2009
to get datatypes of all column from table

Hi,i want to get all columnnames from a table A & its respective datatype.i could get it columnnamefrom below querysel columnname from dbc.columnswhere tablename ='A'and databasename = 'dtbs'how can i get respective datatype?Please help me.Thanks,altruist

Adeel Chaudhry 773 posts Joined 04/08
30 Jul 2009

SELECT TRIM(DatabaseName) AS "DatabaseName", TRIM(TableName) AS "TableName", TRIM(ColumnName) AS "ColumnName", ColumnType FROM DBC.COLUMNS WHERE TableName = 'TableName';For exact data-types and there respective code in the ColumnType column, consult the manuals.Regards,Adeel

-- If you are stuck at something .... consider it an opportunity to think anew.

altruist 4 posts Joined 06/09
30 Jul 2009

thanks!but still from column type i can know char/varchar if i want to know its length then?hey...could you please send me the link where i can get teradata manual? it would be gr8thanks

Adeel Chaudhry 773 posts Joined 04/08
30 Jul 2009

Usually it is good to try your best as well! :)Here is the link: http://www.info.teradata.com/Why don't you just do a "SELECT * FROM DBC.COLUMNS" and checkout the columns .... they are pretty self-explanatory.Regards,Adeel

-- If you are stuck at something .... consider it an opportunity to think anew.

visakhcr 46 posts Joined 11/07
30 Jul 2009

Why don't you try SHOW TABLE table_name; It will give the entire table definition.

Regards,
BB

Venkatesh G 17 posts Joined 05/09
31 Jul 2009

Hi Adeel,I have added a new topic 'how to check if data is in upper case' in 'Teradata Database'.Please reply. Thanks & Regrds,Venkatesh G

Toad 12 posts Joined 12/08
04 Aug 2009

HELP TABLE tblname will also give the details of each column in the same order as in the table DDL.Hope this helps.

tamil 1 post Joined 11/10
19 Nov 2010

Click on Tools menu select 'List Columns' from that list. It will ask for table or view name which give the details of each column

fgascard 1 post Joined 08/12
26 Feb 2013

Thanks Tamil, that did the trick.

You must sign in to leave a comment.