SQL Server create a row in Table B for every row in Table A and put the ID in Table A

Posted by ScottyDoesKnow on Stack Overflow See other posts from Stack Overflow or by ScottyDoesKnow
Published on 2010-05-31T17:49:31Z Indexed on 2010/05/31 17:53 UTC
Read the original article Hit count: 167

Filed under:
|
|

I know how to create a row in Table B for every row in Table A:

INSERT INTO [dbo].[TableB] SELECT 0, 5, 3, [TableAColumn] FROM [dbo].[TableA]

But I need to also put the ID of each new TableB row into a column in TableA, and I can't figure out how to do that.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server