I need to duplicate a row a couple thousand times. I need to change one column from the copied row based on a list of ids.
Psuedo-code:
INSERT INTO MyTable (TabID, Other Columns)
VALUES (TabID = (SELECT TabID FROM OtherTable WHERE ParentID = 1), Other Columns)
Is this doable?
Best Solution
How do you want to change
Tab1
? If you wanted to increment it, for sake of argument, you could do this:A cleaner, neater way is to create a numbers table (code below untested):