By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

Importing .txt to SQL 2000

P: 2
I receive a .txt sales report each month from our retailers with the following format…

A[Customer Name] [Customer ID] [Customer Address] [Customer Phone]
L[Customer ID] [Quantity] [UPC Number]
L[Customer ID] [Quantity] [UPC Number]
...
A[Customer Name] [Customer ID] [Customer Address] [Customer Phone]
L[Customer ID] [Quantity] [UPC Number]
L[Customer ID] [Quantity] [UPC Number]
...

I get one file per retailer per month, so each file would be its own import/batch.

I am trying to import these files into SQL 2000 and populate 3 tables; batch, customer and line-item. However, since there is no delimiter (the fields are defined by char length), I do not know how to parse out the data. I also do not know how to separate the file into the different tables.

Any help would be greatly appreciated.

Thanks
Jun 8 '09 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
Use format file in BCP. For more of format file, read this

Happy coding!

-- CK
Jun 9 '09 #2

P: 2
OK, I see how BCP can be a HUGE help to me on this, thanks. However, I do not see how BCP can separate the customer data line from the following line items.

If I am not mistaken, BCP assumes the entire file is essentially a single table, which my files are not.

Thanks again!!
Jun 9 '09 #3

ck9663
Expert 2.5K+
P: 2,878
Read the part about the -f switch.

It allows you to pass a format file. Format file can specify the structure of the file and table you are trying to upload.

Good luck.

--- CK
Jun 9 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.