I am trying to insert data into a table using jdbc with auto increment column in snowflake from another table. I have skipped the auto increment column and inserting only required column(s) as from the following query
// both tables ddl
CREATE or replace myTargetTable(col1 number(38,0) not null autoincrement,col2 text,constraint conname primary key (col1));
// insert
insert into myTargetTable (COL2) select COL2 from mySrcTable;
It inserts the data correctly with correct auto increment sequence, but the auto increment value takes a random increment in its value if I insert another value
insert into myTargetTable (COL2) values ('randomVal');
It reflects this issue,
Row Col1 Col2
1,374 1374 sd
1,375 1375 sd
1,376 1376 sd
1,377 1793 randomVal - manuel insert to see sequence value
Col1 is auto incr
This issue comes with 260 records+. Is this an issue with auto increment key, please help. Thanks!
PS. This issue also comes if col1 is not primary key, and executing queries on snowflake console.