Hi everyone,
I have three tables related to each other, I want to instert 1000 rows in each of them at the same time, and I dont want to write Insert 1000 times, what should I do ?
Hi everyone,
I have three tables related to each other, I want to instert 1000 rows in each of them at the same time, and I dont want to write Insert 1000 times, what should I do ?
Well, that depends. The data you are inserting, is it in an existing table? or flat file? CSV? Do you really mean "exactly at the same time" or can it be done in the same transaction?
Hi @JohnM, thank you. The insert would be on an existing table, and by ¨at the same time¨ I mean in the same transaction
Where is the data that you are inserting coming from? You can do a simple
INSERT dbo.Table1 (id, firstname, lastnam) SELECT id, firstname, lastname from dbo.Table2;
if the data is another table. If you need to randomly generate data, that's a different story
22 People are following this question.