cancel
Showing results for 
Search instead for 
Did you mean: 

Change the length of a Column

sreelatha_reddy2
Participant
0 Kudos

Hi All,

I have created a table with Product_Name of Length 100 and loaded the data. Now I would like the chage the length to 20. But I am getting the error. Is it like I should drop the column, again add the column with length 20 and load the data again. Is it the only way I can do. Please advise.

alter table "Sales-Product"."PRODUCT" alter (PRODUCT_NAME NVARCHAR(20));

Error: SAP DBTech JDBC: [7] (at 45): feature not supported: cannot shorten the field length: PRODUCT_NAME: line 1 col 46 (at pos 45)

Accepted Solutions (0)

Answers (1)

Answers (1)

pratik_doshi2
Participant
0 Kudos

Hi Sreelatha ,

Please go through the HANA Documentation before Posting the Question.

Here are some excerpts from HANA Documentation:

  • For column table, only increasing the size of a column data type is allowed to prevent data loss. For example, changing from nvarchar(20) to nvarchar(10) or from integer to tinyint will raise an error.
  • For row table, only increasing the size of VARCHAR and NVARCHAR type column is allowed. Other data type changes are not allowed.


You can visit the link:

ALTER TABLE - SAP HANA SQL and System Views Reference - SAP Library


So you can do the following:

You can drop and create it. Take the backup of table to reload it.


Hope this helps

-

Pratik