Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 BULK INSERT question

Author  Topic 

prodigy2006
Yak Posting Veteran

66 Posts

Posted - 2009-01-26 : 22:19:55
I was going through an article and I found few things difficult to understand.

BULK INSERT SalesHistory FROM 'c:\SalesHistoryText.txt' WITH (FIELDTERMINATOR = ',', FIRE_TRIGGERS, BATCHSIZE = 2)

Say this text file has 1000 records in it and I'm trying to insert those into a table. I'm also firing 1 trigger on the table to tell me the number of rows that are inserted.
when we give the batchsize=2, does it insert the data in 500 transactions? If it does then the trigger would be fired 500 times and 500 print statements will be output on the screen.
My concern is that this trigger would slow down the insert process.
So,what would happen when I try to insert 1 million records into a table? Is it gonna be fine since I'm firing only 1 trigger?


Answers will be appreciated.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-27 : 00:27:44
why are you using trigers for this? you could simply use a audit column like date modified in table and use it to determine the records processed once bulk insert is over.
Go to Top of Page
   

- Advertisement -