SET ROWCOUNT 1000; INSERT INTO [Relation]([CustomerId],[UserId],[CreateDate]) SELECT [Id],1,GETDATE() FROM [Customers] WHILE @@ROWCOUNT=1000 INSERT INTO [Relation]([CustomerId],[UserId],[CreateDate]) SELECT [Id],1,GETDATE() FROM [Customers] SET ROWCOUNT 0;
------解决方案-------------------- 一般都這樣做,應該用不了多久,若Relation表有觸發器,把你的trigger禁用掉吧,這樣會快些
SQL code
alter table Relation disable trigger all
--完成後
alter table Relation enable trigger all
------解决方案--------------------