Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to import tab delimited files into a table using BCP 4

Status
Not open for further replies.

DCSage

Programmer
Mar 5, 2010
74
US
Hello.

I need to import text files over a four year period (which is well over 1000 text files). The text files are tab delimited (text is organized in columns...tab delimited right?) and I only want 4 columns from the files.
The text files have headers. I was thinking that my best option would be to use the bcp utility.

1) How would I properly use bcp to import the data into my table DUMP_Vids?

2) I also wanted an error log so that I could see what occurred during the import.

3) Is there also a way to import using conditions from the text files too?

This is what I have so far:

Code:
/*BCP Import to pull in records from a directory to DUMP_Vids table*/

bcp DUMP_Vids in "I:\My Documents- Episodes\Video Logs" -c -T -e

Thank you in advance.

 
I want to thank everyone for assisting me with this problem. Through your suggestions, I was finally able to resolve the BULK Insert issue. BCP did not work, and I think this may have been because of permissions. I also tried Bulk Insert, which failed. I was able to install SQL Server 2005 and BIDS. I began fiddling with SSIS (it wasn't installed earlier). After creating a simple package that contained foreach loop, flat file, export to database process, all 4000+ files exported and processed in less than 10 minutes! Thank you all for everything!!! :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top