Exporting Access DB to SQL Server: Unexpected EOF Error

ms accesssql server

How do I correctly export a table from an old Access .mdb to SQL Server 2012?

In Access I do: right click on table, export as text file and use comma or tab separator.
My line endings are CRLF as seen from Notepad++

Then when I try to import into my RDS SQL Server with

bcp dbname.dbo.tablename in C:\AllModels.txt -n 
    -S servername -U username -P password -b 10000

I am getting:

Starting copy…
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Unexpected EOF encountered in BCP data-file

help help

Best Answer

First, use tab delimited files unless you want to use -t to specify a different delimiter (such as a comma). By default it will accept the tab.

Next, unless you're exporting data with the -n flag, use -c to import the data.

Finally, based on your comments, it looks like there is a mis-match between the size of your table columns and the actual width of the data. That's why you're getting notified the data is being truncated. Match those two up and you'll be all set.

You can check out the MSDN page on bcp for more information on flags, etc.