2012年3月11日星期日

BCP Help - Going Crazy!

I have successfully used BCP before. But, this time, I have an entirely
new import csv file and it's causing me so much trouble. I am working
with a CSV file with more fields than the SQL table but I am following
what BOL tells me to do. PLEASE HELP!!!
ERROR: Incorrect host-column number found in BCP format-file
Here are the specs:
SQL2000
tablename: lbar_mlsdata_temp_resi
fields:
ML_NUMBER varchar 255
Property_Type_Desc varchar 255
bcp fmt file:
8.0
3
1 SQLCHAR 0 255 "," 1 ML_Number
SQL_Latin1_General_CP1_CI_AS
2 SQLCHAR 0 0 "," 0 Listing Agent ID
SQL_Latin1_General_CP1_CI_AS
3 SQLCHAR 0 0 "\r\n" 0 Type/Style Desc
SQL_Latin1_General_CP1_CI_AS
CSV FILE:
"ML_Number","Listing Agent ID","Listing Agent Name"
"204980","33404","Cindy W Crutcher"
"300614","16901","Linda C Wilson"
"406804","21109","Glynn A Gregory"
"312289","17314","Linda L Friess"
command line:
bcp databasename..lbar_mlsdata_temp_resi in ""c:\bcptest\resi2.csv"" -f
""c:\bcptest\bcp.fmt"" -F 2 -o ""c:\bcptest\VendorOut.txt"" -U x -P x -S
x
*** Sent via Developersdex http://www.examnotes.net ***The answer to your problem doesn't immediately occur to me. Although it
may occur to someone else here.
Were I you, I would create a table with just the three columns that
match your BCP format spec...and try that. If that works, then run
subsequently a stored procedure to Insert the data into the final
destination table.
FYI it's my understand also that CSV files have no text qualifiers
like: "" and just commas seperating values. I call the file you have a:
quote-comma delimted file. But that probably isn't too relative to your
issue.|||Ok, so I figured out at least part of the ISSUE. The field names in the
BCP fmt file has spaces in them. That was the issue. I should have known
this, but, lesson learned.
I am going to post the new problem to another message.
Thanks!
*** Sent via Developersdex http://www.examnotes.net ***

没有评论:

发表评论