I have a table A filled with records. I created a table B with same columns, and I want to copy all contents of A to B. However, table A has an auto incremented key, so if i had first three records (1,’itemA’) (2,’itemB’) (5,’itemE’) (assuming that 3,4,5 where deleted later). Those recors will be inserted into table B as (1,’itemA’) (2,’itemB’) (3,’itemE’).
Is there a way to insert them exactly the same ?
Another thing is, table A is on mySql, and table B is on MS SQL Server
The answers above are good, but on MS SQL you can’t insert auto increment value unless if you execute turn identiy_insert off:
This is EXCATLY what I was looking for. Thank you all 🙂