我想通过在Teradata中运行查询将列名导出到excel表中。我使用了ctrl + c但它没有用。提前谢谢。
答案 0 :(得分:0)
要获取列名称,请打开answeret,然后保存结果集。 文件>另存为>
答案 1 :(得分:0)
我找到了答案show table tablename
答案 2 :(得分:0)
我经常要报告列和dbc.columns是执行此操作的最佳方法。它们都是正确填充的,所以修剪使它们很好地粘贴到excel上。我还添加了一个case语句,它将为你翻译数据类型。
sel
trim(databasename)
, trim(tablename)
, trim(columnname)
, max(case
when columntype = 'D' then 'decimal(' || decimaltotaldigits || ', ' || decimalfractionaldigits || ')'
when columntype = 'CV' then 'varchar(' || columnlength || ')'
when columntype = 'CF' then 'char(' || columnlength || ')'
when columntype like 'I%' then 'integer'
else 'unknown' end) as colDDL
from dbc.columns where tablename in (<sometableList>)
and databasename in (<someDBList>)
order by column_id
DBC.columns数据tpe映射示例的完整列表:
create volatile table vt_woe_col_list
as (
select
trim(columnname) as column_name
, case when ColumnType in ('CF','CV') then 'Character'
when ColumnType in ('D','F','I1','I2','I') then 'Numeric'
when ColumnType in ('DA') then 'Date'
when ColumnType in ('SZ','TS') then 'TimeStamp'
else 'Skip' end as process_type
, case trim(columntype)
when 'AT' then 'TIME'
when 'BF' then 'BYTE'
when 'BO' then 'BLOB'
when 'BV' then 'VARBYTE'
when 'CF' then 'CHAR'
when 'CO' then 'CLOB'
when 'CV' then 'VARCHAR'
when 'D' then 'DECIMAL'
when 'DA' then 'DATE'
when 'DH' then 'INTERVAL DAY TO HOUR'
when 'DM' then 'INTERVAL DAY TO MINUTE'
when 'DS' then 'INTERVAL DAY TO SECOND'
when 'DY' then 'INTERVAL DAY'
when 'F' then 'FLOAT'
when 'GF' then 'GRAPHIC'
when 'GV' then 'VARGRAPHIC'
when 'HM' then 'INTERVAL HOUR TO MINUTE'
when 'HR' then 'INTERVAL HOUR'
when 'HS' then 'INTERVAL HOUR TO SECOND'
when 'I1' then 'BYTEINT'
when 'I2' then 'SMALLINT'
when 'I' then 'INTEGER'
when 'MI' then 'INTERVAL MINUTE'
when 'MO' then 'INTERVAL MONTH'
when 'MS' then 'INTERVAL MINUTE TO SECOND'
when 'SC' then 'INTERVAL SECOND'
when 'SZ' then 'TIMESTAMP WITH TIME ZONE'
when 'TS' then 'TIMESTAMP'
when 'TZ' then 'TIME WITH TIME ZONE'
when 'YM' then 'INTERVAL YEARTO MONTH'
when 'YR' then 'INTERVAL YEAR'
when 'UT' then 'UDT Type'
end as column_type_desc
, a.*
from dbc.columns A
where trim(tablename )='t_woe_data_samp'
and trim(databasename)= 'DUCSMAD'
) with data
primary index(column_name)
on commit preserve rows;
答案 3 :(得分:0)
在结果集视图首选项\复制选项中更改设置\ 选中&#34;复制包含列标题&#34;
&#34;结果集视图首选项&#34;是第一个在结果集视图窗口中看起来像钳子的按钮。