从 Teradata DB 中获取包含 Table 信息的所有列
Get All Columns with Table Information from Teradata DB
这个有效,只生成列名:
SELECT ColumnName
FROM dbc.columnsV
WHERE DatabaseName = 'DB_NAME';
但 我还想查看 table 名称和列类型。
好的...这个很简单,我自己设法回答了:
SELECT *
FROM dbc.columnsV
WHERE DatabaseName = 'DB_NAME';
生成所需的 table 以及人们可能需要的所有内容,包括这些列:
DatabaseName
TableName
ColumnName
ColumnFormat
ColumnTitle
SPParameterType
ColumnType
ColumnUDTName
ColumnLength
DefaultValue
Nullable
CommentString
DecimalTotalDigits
DecimalFractionalDigits
ColumnId
UpperCaseFlag
Compressible
CompressValue
ColumnConstraint
ConstraintCount
CreatorName
CreateTimeStamp
LastAlterName
LastAlterTimeStamp
CharType
IdColType
AccessCount
LastAccessTimeStamp
CompressValueList
TimeDimension
VTCheckType
TTCheckType
ConstraintId
ArrayColNumberOfDimensions
ArrayColScope
ArrayColElementType
ArrayColElementUdtName
PartitioningColumn
ColumnPartitionNumber
ColumnPartitionFormat
ColumnPartitionAC
PseudoUDTFieldId
PseudoUDTFieldType
StorageFormat
DatasetSchemaName
InlineLength
TSColumnType
AutoColumn
RowVersionNo
所以,需要的查询是:
SELECT DatabaseName, TABLENAME, ColumnName, ColumnType
FROM dbc.columnsV
WHERE DatabaseName = 'DB_NAME';
这个有效,只生成列名:
SELECT ColumnName
FROM dbc.columnsV
WHERE DatabaseName = 'DB_NAME';
但 我还想查看 table 名称和列类型。
好的...这个很简单,我自己设法回答了:
SELECT *
FROM dbc.columnsV
WHERE DatabaseName = 'DB_NAME';
生成所需的 table 以及人们可能需要的所有内容,包括这些列:
DatabaseName
TableName
ColumnName
ColumnFormat
ColumnTitle
SPParameterType
ColumnType
ColumnUDTName
ColumnLength
DefaultValue
Nullable
CommentString
DecimalTotalDigits
DecimalFractionalDigits
ColumnId
UpperCaseFlag
Compressible
CompressValue
ColumnConstraint
ConstraintCount
CreatorName
CreateTimeStamp
LastAlterName
LastAlterTimeStamp
CharType
IdColType
AccessCount
LastAccessTimeStamp
CompressValueList
TimeDimension
VTCheckType
TTCheckType
ConstraintId
ArrayColNumberOfDimensions
ArrayColScope
ArrayColElementType
ArrayColElementUdtName
PartitioningColumn
ColumnPartitionNumber
ColumnPartitionFormat
ColumnPartitionAC
PseudoUDTFieldId
PseudoUDTFieldType
StorageFormat
DatasetSchemaName
InlineLength
TSColumnType
AutoColumn
RowVersionNo
所以,需要的查询是:
SELECT DatabaseName, TABLENAME, ColumnName, ColumnType
FROM dbc.columnsV
WHERE DatabaseName = 'DB_NAME';