Query run result in Teradata -


i running below query in teradata editor:

select 'emp_info_main' table_name, count(1) record_count schema.table1 union select 'emp_sal' table_name, count(1) record_count schema.table2 union select 'department_info' table_name, count(1) record_count schema.table3; 

the query giving me below result:

table_name  | record_count ------------|-------------  emp_info    | 10  emp_sal     | 11  departme    | 110  

the first column not showing complete table name. can please here?

this common issue.

in teradata first select of union determines resulting data typ , column name, either change order of selects start longest name or add cast in 1st select:

select cast('emp_info_main' varchar(20)) table_name, count(1) record_count schema.table1 union select 'emp_sal' table_name, count(1) record_count schema.table2 union select 'department_info' table_name, count(1) record_count schema.table3; 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -