Okay, our data model has changed slightly and we are introducing a new table, NEW_TABLE, with PK/Identity column. This table will be associated with an existing table, LEGACY_TABLE, via a FK which is nullable (nullable so that we can time the rollout of app changes with in a lax fashion).
As part of the db change script we would like to create NEW_TABLE, alter LEGACY_TABLE to add the FK, add the FK constraint, and insert all the records required into NEW_TABLE and update the the FKs in EXISTING_TABLE in order to link up with LEGACY_TABLE.
I would rather not do this via a cursor, but can't think of any other way to insert the records into NEW_TABLE and then assign the FKs in LEGACY_TABLE.
Thoughts?
TR
As part of the db change script we would like to create NEW_TABLE, alter LEGACY_TABLE to add the FK, add the FK constraint, and insert all the records required into NEW_TABLE and update the the FKs in EXISTING_TABLE in order to link up with LEGACY_TABLE.
I would rather not do this via a cursor, but can't think of any other way to insert the records into NEW_TABLE and then assign the FKs in LEGACY_TABLE.
Thoughts?
TR