I have two tables that share a one to one relationship (in truth its one to many but I use it as one to one). The table with the foreign key has existing records with the foreign key set to NULL. I want to write a TSQL script that will add one default record into the second table for each of the records in the first and update the foreign key of the first to relate to the new records? Any idea how I might do this?
I want to create a script so I can update not only my development database but the live as well, when the time comes to publish my new version.
Thanks.
Edits:

Further Edits:
I’m going to insert default values using literals. I can’t be more specific. It is a really simple scenario involving a one-to-many relationship between two tables.
Still Further Edits:
I’m under NDA of sorts. I could spend the time to mock up an example situation. I need to crate records in Table1 above, one for each record in Table2 and then set the Key from table 1 to the Foreign Key in the associated record in table two. This seems like its a common thing to do.
I think the solution is to create a temporary table, but I’m not sure of how to do the details. Is there a way to insert a temporary table and save off the identity of the inserted table into the temp table?
Making some assumptions, the following code can do this:
The assumptions are: