| |

VerySource

 Forgot password?
 Register
Search
View: 1124|Reply: 9

BCP import data problem, prompting unexpected EOF ~ urgent

[Copy link]

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-27 15:40:01
| Show all posts |Read mode
Start copying ...
SQLState = S1000, NativeError = 0
Error = [Microsoft] [ODBC SQL Server Driver] Unexpected EOF encountered in BCP data file

0 rows copied.
Packet size (bytes): 4096
Clock time (ms): 31

The BCP statement is written like this:
exec master..xp_cmdshell 'bcp "test.abc.inf_TEST001" in "E:\Work\Task\TEST001" -c -r "\n" -SWJP -Usa -Psa'

Which prawn helped me to see what the problem is, I am grateful ~~
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-2-21 07:30:01
| Show all posts
EXEC master..xp_cmdshell 'bcp "dbname..tablename" in c:\DT.txt -c -Sservername -Usa -Ppassword'
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-2-21 17:00:01
| Show all posts
Is there anything wrong with my sentence? Already prompted "Start Copying ..."
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-2-22 14:15:01
| Show all posts
Data file with suffix .txt
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-2-22 21:30:01
| Show all posts
TO我是杀人狂
The TEST001 file is generated by another program (the file name is like this, without a suffix, and it is in UNIX format). My program task is to import this file into the database.
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-2-23 15:15:01
| Show all posts
The bcp import format should be the one I wrote above, but I don't know if I can import the UNIX format ...
Reply

Use magic Report

0

Threads

30

Posts

25.00

Credits

Newbie

Rank: 1

Credits
25.00

 China

Post time: 2020-2-29 21:00:01
| Show all posts
The landlord does not set a separator
For example, add -t after -c, which means comma separated
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-3-5 11:30:01
| Show all posts
TOkxiaper
Using your method, there seems to be no problem reading the file, but the following problems appear
Start copying ...
SQLState = 22001, NativeError = 0
Error = [Microsoft] [ODBC SQL Server Driver] string data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft] [ODBC SQL Server Driver] string data, right truncation
SQLState = 22001, NativeError = 0

Please troubleshoot again, is there a problem with my file format or is it something else?
Reply

Use magic Report

0

Threads

30

Posts

25.00

Credits

Newbie

Rank: 1

Credits
25.00

 China

Post time: 2020-3-13 11:00:02
| Show all posts
an examination:
1. The number of fields in the inf_TEST001 table may not be enough. It must be the same as the number of comma-separated segments in your data.
2. Field length may be insufficient
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-3-23 22:15:01
| Show all posts
Haha, thank youkxiaper
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list