Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

DBC.COLUMNS

Updated on 2023-03-17 GMT+08:00

DBC.COLUMNS view is a table containing information about table and view columns, stored procedures, or macro parameters. The view includes the following column names: DatabaseName, TableName, ColumnName, ColumnFormat, ColumnTitle, ColumnType, and DefaultValue. In GaussDB(DWS), this table is equivalent to the information_schema.columns table.

NOTE:

This feature requires one time execution of the custom script file DSC/scripts/teradata/db_scripts/mig_fn_get_datatype_short_name.sql.

For more information about the steps to execute the file, refer System Requirements and Prerequisites sections respectively.

The DSC migrates the following dbc.columns to their corresponding information_schema columns.

Table 1 Migration of dbc.columns to information_schema columns

dbc.columns

information_schema.columns

ColumnName

Column_Name

ColumnType

mig_fn_get_datatype_short_name (data_Type)

ColumnLength

character_maximum_length

DecimalTotalDigits

numeric_precision

DecimalFractionalDigits

numeric_scale

databasename

table_schema

tablename

table_name

ColumnId

ordinal_position

The following assumptions are made when migrating dbc.columns:

  • The FROM clause will contain only the dbc.columns TABLE NAME
  • COLUMN NAME can be in the form of column_name or schema_name.table_name.column_name.

Migration of dbc.columns is not supported for the following cases:

  • If the FROM clause has an ALIAS for dbc.columns table name (dbc.columns alias).
  • If dbc.columns is combined with other tables (FROM dbc.columns alias1, table1 alias2 OR dbc.columns alias1 join table1 alias2).
NOTE:
  • If the input SELECT statement includes dbc.column COLUMN NAMES directly, then the tool will migrate the input column names as an ALIAS. For example, the input column name DecimalFractionalDigits is migrated to numeric_scale with an ALIAS DecimalFractionalDigits.

    Example:

    Input:
    1
    2
    3
    4
    5
    6
    SEL
           columnid
           ,DecimalFractionalDigits
         FROM
           dbc.columns
    ;
    

    Output:

    1
    2
    3
    4
    5
    6
    SELECT
           ordinal_position columnid
           ,numeric_scale DecimalFractionalDigits
         FROM
           information_schema.columns
    ;
    
  • For table names and schema names, the DSC will convert all string values to lowercase. To maintain case-sensitivity, the table/schema names should be within double quotes. In the following input example, "Test" will not be converted to lower case.
    1
    2
    3
    4
    5
    6
    SELECT
              TableName
         FROM
              dbc . columns
         WHERE
              dbc.columns.databasename = '"Test"';
    

Input: dbc.columns table with all supported columns

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
SELECT
'$AUTO_DB_IP'
,objectdatabasename
,objecttablename
,'$TX_DATE_10'
,''
,'0' 
,FirstStepTime
,FirstRespTime
,RowCount
,cast(RowCount*sum(case when T2.ColumnType ='CV' then T2.ColumnLength/3 else  T2.ColumnLength end) as decimal(38,0))
,'3' 
,''
,'BAK_CLR_DATA'
,'2'
,''
FROM TMP_clr_information T1
inner join dbc.columns T2
on T1.objectdatabasename =T2.DatabaseName
and T1.objecttablename =T2.TableName
where  T2.DatabaseName not in (
sel child from dbc.children 
where parent='$FCRM_DB'
)
group by 1,2,3,4,5,6,7,8,9,11,12,13,14,15;

Output

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SELECT
          '$AUTO_DB_IP'
          ,objectdatabasename
          ,objecttablename
          ,'$TX_DATE_10'
          ,''
          ,'0'                                
          ,FirstStepTime
          ,FirstRespTime
          ,RowCount
          ,CAST( RowCount * SUM ( CASE WHEN mig_fn_get_datatype_short_name ( T2.data_Type ) = 'CV' THEN T2.character_maximum_length / 3 ELSE T2.character_maximum_length END ) AS DECIMAL( 38 ,0 ) )                        
          ,'3'                                
          ,''
          ,'BAK_CLR_DATA'
          ,'2'
          ,''
     FROM
          TMP_clr_information T1 INNER JOIN information_schema.columns T2
               ON T1.objectdatabasename = T2.table_schema
          AND T1.objecttablename = T2.table_name
     WHERE
          NOT EXISTS (
               SELECT
                         child
                    FROM
                         dbc.children
                    WHERE
                         child = T2.table_schema
                         AND( parent = '$FCRM_DB' )
          )
     GROUP BY
          1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,11 ,12 ,13 ,14 ,15
;

Input: dbc.columns table with TABLE NAME

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT
          TRIM( ColumnName )
          ,UPPER( dbc.columns.ColumnType )
     FROM
          dbc . columns
     WHERE
          dbc.columns.databasename = '"Test"'
     ORDER BY
          dbc.columns.ColumnId
;

Output

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
SELECT
          TRIM( Column_Name )
          ,UPPER( mig_fn_get_datatype_short_name ( information_schema.columns.data_Type ) )
     FROM
          information_schema.columns
     WHERE
          information_schema.columns.table_schema = CASE
               WHEN TRIM( '"Test"' ) LIKE '"%'
               THEN REPLACE( SUBSTR( '"Test"' ,2 ,LENGTH( '"Test"' ) - 2 ) ,'""' ,'"' )
               ELSE LOWER( '"Test"' )
          END
     ORDER BY
          information_schema.columns.ordinal_position
;

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback