Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

Basic insert for large tables

$
0
0
Hi,This seems simple but I'm having trouble. We have a process that when it falls behind starts to do very large inserts, selecting from one table into another. As they are written now, when the source table gets very large the log grows on the server to the point it maxes the drive. I would like to modify the syntax so it does batches of 10,000 at a time. All my attempts at putting it in a while loop have just lead it to insert the same 10,000 rows each time. Thanks for any help.INSERT INTO [dbo].[ErrorLog_last48] ([EventDate] ,[ApplicationID] ,[SessionID] ,[ServerName] ,[Level] ,[Message] ,[StackTrace] ,[MetaData] ,[DateIn]) SELECT TOP 10000 [EventDate] ,[ApplicationID] ,[SessionID] ,[ServerName] ,[Level] ,[Message] ,[StackTrace] ,[MetaData] ,[DateIn] FROM [dbo].[ErrorLogExport]

Viewing all articles
Browse latest Browse all 6525

Trending Articles