All Forums UDA
rlaskar 18 posts Joined 03/06
18 May 2006
SQL to retrieve datatype of a column

Hi,I was trying to identify the datatype of a column using teradata SQL. While TYPE returns datatype of the column for all rows. So if it's 1000's of record in a column then using TYPE for that column would return 1000 times datatype of that column.I am sure there are better way of doing this, pls let me know.Thanks,rlaskar

j355ga 100 posts Joined 12/05
18 May 2006

select type(my_foo_col) from foobar group by 1;orselect distinct type(my_foo_col) from foobar;

Jeff

dnoeth 4628 posts Joined 11/04
19 May 2006

> select distinct type(my_foo_col) from foobar;will be heavily skewed (all rows on a single AMP)Better use: select type(foobar.myfoocol);Don't ask me why, but this is not accessing the table: -> The row is sent directly back to the user as the result of statement 1. Or query the system tables:select columntypefrom dbc.columnswhere databasename = 'foo' and tablename = 'foobar'and columnname = 'myfoocol';Dieter

Dieter

rlaskar 18 posts Joined 03/06
19 May 2006

Thanks.

You must sign in to leave a comment.