I'm inserting data from one table into several others. The first insert will create a new userid. This new userid will be used in succeeding inserts. I will also continue inserting username from the source table into other tables. The chain of inserts below are for one user. There will be probably 2000 users involved.
I'm familiar with how this can be done using a cursor. Is there some other way to do this chain of inserts without a cursor?
insert into table 1 using @username and @firstname from source table
insert into table 2 using userid generated from table 1 (userid1)
insert into table 3 using @username and userid1
insert into table 4 using userid1