sql - Column changes values when inserted into another table -


i have simple query use transfer data 1 table another, when select values second table, shows next integers in specific column, column has identity constraint in first table doesn't transfer it.

insert table2 (id, name, phone)     select id, name, phone      table1 

table1 values are

1 john  123456 2 david 456789 3 tony  547892 

but in table2 shows

4 john  123456 5 david 456789 6 tony  547892 

how can avoid increment in id column, while table2 id column doesn't have identity constraint?

there multiple solutions, quick workaround following:

insert table2 (id, name, phone) select (id * 1)        ,name        ,phone  table1 

Comments