Cyber-Drugs
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!
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
its described in Books online
bcp utiliy-> parameters
mk:@MSITStore:C:\Program%2 0Files\Mic rosoft%20S QL%20Serve r\80\Tools \Books\adm insql.chm: :/ad_impt_ bcp_3vqr.h tm
bcp utiliy-> parameters
mk:@MSITStore:C:\Program%2
also you copied data from the table as 'native' format
ASKER
Perfect, thanks again! :)
ASKER
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!