SQL - questions on bcp .

i;m trying to use bcp to import a csv file into an existing table.
i have taken care of the data type of the existing table and the number of fields by using the format file .

now i have minimised the entry to only one line in the csv file.
I still got the following error.

-------------------------------
Starting copy....
SQLState=S1000, NativeError=0
Error=[Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file.
0 rows copied
-------------------------------

i really cannot find out what is wrong with the csv file.
Any hint or pointer will be much appreciated

Justin


justsradAsked:
Who is Participating?
 
Anthony PerkinsCommented:
You have a discrepancy between the number of column defined in the header (66) and the actual values in the data (29).
0
 
LowfatspreadCommented:
check for nulls or tabs in the source file


ANY ASCII CONTROL CHARACTERS IN THE SOURCE COULD CAUSE YOU PROBLEMS
(i mean an ascii null rather than a database null)
0
 
Anthony PerkinsCommented:
Try posting a sample of the file that is giving you problems and indicate which line is causing the error.
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
Anthony PerkinsCommented:
If I was to guess I suspect one of the fields contains double quotes.
0
 
justsradAuthor Commented:
Thanks for everyone's feedback and advise.


I have attached two files:

1. meunitem10.csv ( this file's content to be imported to SQL's table)
2. Add-Jade-Menuitem.xls  (The header column is obtained by using the DTS wizard to export out the table. )


menuitem10.csv
Add-Jade-Menuitem.xls
0
 
justsradAuthor Commented:
To Lowfatspread: i will try to search for the Ascii null, could it be seen using the linux command "cat -v " Thanks.

To acperkins:: i have just double checked it, none exists. Thanks
0
 
justsradAuthor Commented:
almost forget , the command that i typed as below:

bcp pos.dbo.menudef in menuitem10.csv -c -t, -r\n -f mytable.fmt -P pass
0
 
justsradAuthor Commented:
Great help indeed!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.