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
 SQL Server Administration (2005)
 BULK INSERT and BATCHSIZE

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-09-30 : 17:34:38
The batch size parameter of BULK INSERT commits data in batches. By default the batch size is 0. That means the whole input file is a single batch. If an error occurs while importing the whole batch is discarded.

On the other hand if you specify the batch size only the records in the batch are discarded.

Here is my problem. My batch size is 1000. Somewhere at batch 15 there is an error at one row. The whole batch 15 is discarded. The ERRORFILE contain the single error row. How to get the information of rest 999 records. Does anyone have a solution ?


------------------------
I think, therefore I am - Rene Descartes

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-09-30 : 17:36:37

Further info,
The files are really huge (25 GB text files)
There is no unique key in input file
I can not make batchsize 1 (though that will work;-)


------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-30 : 17:48:30
Are you inserting into production tables directly, or are you inserting into staging tables?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-09-30 : 17:49:36
staging

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-30 : 18:10:10
Which error do you get if all columns in staging area is varchar?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-09-30 : 18:15:44
quote:
Which error do you get if all columns in staging area is varchar?


That is a good suggestion. I will probably not get any error!!

My other problem is - which editor to use, to edit the files. I am using UltraEdit. Is there a better editor?

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-01 : 00:13:26
That's the reason for the name staging.
Import to all varchar columns, then run your integrity checks.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -