- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How can we change the column order in Hive table without deleting data.
- Labels:
-
Apache Hive
Created on ‎04-23-2019 11:01 PM - edited ‎09-16-2022 07:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎04-24-2019 02:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This command moves column_name after column_name2:
alter table table_name change column column_name column_name column_name_type after column_name2;
You have to put the column_name twice (or you can change column name) and type of the column.
Regards
Andrzej
Created ‎04-24-2019 02:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This command moves column_name after column_name2:
alter table table_name change column column_name column_name column_name_type after column_name2;
You have to put the column_name twice (or you can change column name) and type of the column.
Regards
Andrzej
Created ‎11-30-2022 06:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In this solution, we are able to change position of a single column. Is it possible to change positions of 2 or more consecutive columns in the same way ?
Created ‎05-07-2019 09:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎05-09-2019 06:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's ok
Created on ‎05-15-2019 01:58 AM - edited ‎05-15-2019 02:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are right - thank you for pointing this out.
