Quantcast
Channel: SCN : Unanswered Discussions - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 4343

Issue on column length changing in HANA

$
0
0

Hi Experts,

 

I encounter the following issues.

1. Try to create a column table with a DATE type column, and insert some values.

CREATE COLUMN TABLE test1(D DATE); 
INSERT INTO test1(D) VALUES (CURRENT_DATE);
SELECT D, length(D) FROM test1;

 

The result would be like:

D                      length(D)
----                    ------
Dec 8, 2014     10

2. Try to change the type of column D from DATE to NVARCHAR(8), and it did work.

ALTER TABLE TEST1 ALTER(D NVARCHAR(8));
SELECT D, length(D) FROM test1

The result would be like:

D                      length(D)
----                    ------
2014-12-08      10

3. Try to insert a string with more than 8 characters into table, but failed.

insert into TEST1 values(to_nvarchar(current_date));

Could not execute 'insert into TEST1 values(to_nvarchar(current_date))' in 258 ms 23 µs .

SAP DBTech JDBC: [274]: inserted value too large for column: Failed in "D" column with the value '2014-12-08'

 

Questions:

Why is it possible that HANA still keeps the original record of DATE type with length greater than 8(in this case 10) after the column type has changed to NVARCHAR(8)? I assume it would either not allow to change the column type from DATE to NVARCHAR(8) because it contains a record with length greater than 8, or it would just drop the record or change it to other format, something like that?

 

Appreciated for any input.

 

Thanks and Regards,

Aron


Viewing all articles
Browse latest Browse all 4343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>