Link to home
Start Free TrialLog in
Avatar of Cyber-Drugs
Cyber-DrugsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

BCP Function Problem

Hi guys,

I've recently found out about the command prompt function BCP.

I am testing it out, and am able to export data to a file using this:

BCP Northwind.dbo.Categories out c:\categories.txt -n -Smyservername -Uusername -Ppassword

and it works fine, as it outputs this:

Starting copy...
8 rows copied.

So I now want to import the data back into the database, so I use this:

BCP Northwind.dbo.Categories in c:\categories.txt -c -Smyservername -Uusername - Ppassword

and when I run that, it returns the following error:

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



What am I doing wrong?

Cheers guys!
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cyber-Drugs

ASKER

AHA, works a charm now.

Before I set this question as answered, could you quickly let me know the difference between -c and -n, and which is better for which situation?

Thanks again aneeshattingal!
its described in Books online
bcp utiliy-> parameters


mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%20Server\80\Tools\Books\adminsql.chm::/ad_impt_bcp_3vqr.htm

also you copied data from the table as 'native' format
Perfect, thanks again! :)