G
It's a general algorithm of action in coping with data on the auto-increment field. How do you do that with the Android? If there are no other tables with the floors referring to this auto-increment field (or other fields in this table referring to it), then simply copy: Instruction insert database.schema.table (fieds) select from ...
and on the list of the fields of the target table, and on the seclet, you don't mention this auto-increment field.
That's it. Only if... If there are tables with the floors invoking this field, it will first be necessary to establish a time table with two layers, old and new ID. Fill it (as long as the field is 'old ID') all the lines to be moved (this is 1 request insert-select)
further to the main copying of the cadet, fast + receipt of the new ID and maintenance of its interim table (the last ID - variable @@identity to be read immediately after each induction operation, e.g. select @newid = @@@@@identity )Once the core table has been moved, we copy the references to it (one request), and the field value is changed from the old to the new (instruction insert-select and in the grid adding to the time table with the connection - field reference = 'old id')If there is a field in the main portable table referring to the ID auto-incremental, then another field is needed in the time table - 'old reference to ID' (also provisionally retained, in the same request as 'old ID'). With the main copying, the target table replaces any existing ID values in the new table. After major copying by one request (with joining the time table, replace the meaning of this reference to the current new table)If ID conflicts are not foreseen (e.g. target table - empty) and associated tables should also be copied, the keys could be copied without recosting. Just temporarily disconnect the auto increment rule, copy as it is, with all fields. Then insert this rule back:SET IDENTITY_INSERT [ database_name . [ schema_name ] table OFFSET IDENTITY_INSERT [ database_name . [ schema_name ] table ON