select concat('`',column_name,'`') colname,
case when NUMERIC_PRECISION is not null and (data_type='decimal' or data_type='numeric') then
concat('decimal(' , NUMERIC_PRECISION, ',' , NUMERIC_SCALE , ')' )
when (CHARACTER_MAXIMUM_LENGTH is not null or data_type = 'uniqueidentifier') and data_type not like '%text%' then
'string'
when data_type = 'datetime' then
'timestamp'
when data_type = 'money' then
'decimal(9,2)'
when data_type = 'tinyint' then
'int'
else
data_type
end as data_type,
' ,' as splitCharacter
from information_schema.columns
where table_name = 'hrmpersonatt' and table_schema='datacentern';
MySQL表字段转换成Hive字段
最新推荐文章于 2024-09-04 13:25:57 发布