teradata查询表结构

show table tablename;
help table tablename;
SELECT  UPPER(TRIM(T1.COLUMNNAME)), 
            COALESCE(T1.COLUMNTITLE,'NO TITLE'), 
            CASE WHEN T1.COLUMNTYPE = 'BF' THEN
				       	'BYTE'
				       	WHEN T1.COLUMNTYPE = 'I1' THEN
				       	'BYTEINT'
				       	WHEN T1.COLUMNTYPE = 'VF' THEN
				       	'VARBYTE'
				       	WHEN T1.COLUMNTYPE = 'DA' THEN
				       	'DATE'
				       	WHEN T1.COLUMNTYPE = 'F' THEN
				       	'FLOAT'
				       	WHEN T1.COLUMNTYPE = 'I2' THEN
				       	'SMALLINT'
				       	WHEN T1.COLUMNTYPE = 'I' THEN
				       	'INTEGER'
				       	WHEN T1.COLUMNTYPE = 'CF' THEN
				       	'CHAR('|| TRIM(T1.COLUMNLENGTH) ||')'
				       	WHEN T1.COLUMNTYPE = 'CV' THEN
				       	'VARCHAR('|| TRIM(T1.COLUMNLENGTH) ||')'
				       	WHEN T1.COLUMNTYPE = 'D' THEN
				       	'DECIMAL' || '(' || T1.DECIMALTOTALDIGITS || ',' || T1.DECIMALFRACTIONALDIGITS || ')'
				  ELSE  
				       	 'UNKNOW'
				  END, 
          T1.NULLABLE,
          CASE WHEN T2.COLUMNNAME is NULL THEN 'N' ELSE 'Y' END  
    FROM DBC.COLUMNS T1
    LEFT JOIN DBC.Indices T2
    ON T1.DATABASENAME = T2.DATABASENAME
    AND T1.TABLENAME = T2.TABLENAME
    AND T1.COLUMNNAME = T2.COLUMNNAME
    AND (T2.IndexType = 'Q' or T2.IndexType = 'P')
    WHERE T1.DATABASENAME='p_pdata'
    AND   T1.TABLENAME='ods_prpcmain'
    order by T1.ColumnId;

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值