SQL 在 Teradata 中显示列名和数据类型?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29525437/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Show column name and data type in Teradata?
提问by anm
Is there a way to get column nameand data typein a Teradata SQL Assistant 15.0
view?
有没有办法在视图中获取列名和数据类型Teradata SQL Assistant 15.0
?
In Oracle 11g
you can do something like desc tablename
and get a script result set of the following :
在Oracle 11g
你可以做这样的事情desc tablename
,并得到一个脚本的结果集如下:
Name Null Type
test_id NOT NULL NUMBER(19)
test_name VARCHAR2(255)
test_department VARCHAR2(255)
test_year TIMESTAMP(6)
test_external_id NUMBER(10)
名称空类型
test_id NOT NULL NUMBER(19)
test_name VARCHAR2(255)
test_department VARCHAR2(255)
test_year TIMESTAMP(6)
test_external_id NUMBER(10)
So far I've tried help view viewname
and the result provides all column namesbut the values for the data typeare all nulls.
到目前为止,我已经尝试过help view viewname
,结果提供了所有列名,但数据类型的值都是空值。
回答by Angus Chung
You can use "SHOW VIEW VIEW_NAME" or "HELP COLUMN VIEW_NAME.*" to get all column names and datatype in the view.
您可以使用“SHOW VIEW VIEW_NAME”或“HELP COLUMN VIEW_NAME.*”来获取视图中的所有列名和数据类型。
Example
例子
HELP COLUMN dbc.Allspace.*
OUTPUT
输出
Column Name Type Nullable Format Max Length
Vproc I2 N -(5)9 2
DatabaseName CF Y X(30) 30
AccountName CF Y X(30) 30
TableName CF Y X(30) 30
MaxPerm F N ---,---,---,---,--9 8
MaxSpool F N ---,---,---,---,--9 8
MaxTemp F N ---,---,---,---,--9 8
CurrentPerm F N ---,---,---,---,--9 8
CurrentSpool F N ---,---,---,---,--9 8
CurrentTemp F N ---,---,---,---,--9 8
PeakPerm F N ---,---,---,---,--9 8
PeakSpool F N ---,---,---,---,--9 8
PeakTemp F N ---,---,---,---,--9 8
MaxProfileSpool F Y ---,---,---,---,--9 8
MaxProfileTemp F Y ---,---,---,---,--9 8
回答by Aritra Bhattacharya
you can use : help table tablename
(in case of tables) and help view viewname
in case of views
您可以使用:(help table tablename
在表格的情况下)和help view viewname
在视图的情况下