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)
 Is this possible in BCP or BULK INSERT

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-10-03 : 21:50:59
Is this possible in BCP or BULK INSERT?

1. I have a text file with 100 records.
2. 20 of them are bad.
3. Can I import 80 rows in a table and 20 in a bad file at one shot?

My experience is - BCP stops executing as soon as it encounters an error.


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

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-03 : 22:12:49
Yes you can do in Bulk insert
1)Specify Maxerrors to capture errors
2)Specify error_file to export error to text file
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-10-04 : 00:07:42
I tried that, it didn't work out. I will try again, probably i missed something.

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

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-10-06 : 15:38:45
quote:

1)Specify Maxerrors to capture errors
2)Specify error_file to export error to text file



It was NOT working for me. Then I found out that i have special character at the EOF.

I could manage using the combination of MAXERRORS & LASTROW (lastrow -1, in my case)

Thanks a lot, Sodeep.

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

- Advertisement -