Shubzumt
Shubzumt

Reputation: 143

Output of Hive String Function to be replaced by the values in Table

I have a Table like below sample set.

 ColA
 AAAA
 BBBB
 CCCC

I used following query to get the output.

SELECT LPAD (ColA,5,'0')FROM TableName;

I get following output.

  ColA
  0AAAA
  0BBBB
  0CCCC    

But I want to replace the value in table with the output values. Is it Possible? If yes, some help would be appreciated!

Upvotes: 0

Views: 356

Answers (1)

leftjoin
leftjoin

Reputation: 38335

You can insert overwrite table from itself:

insert overwrite table TableName
SELECT LPAD (ColA,5,'0') as ColA,
       ColB,
       ...
       ColN
  FROM TableName;

Upvotes: 1

Related Questions