Link to home
Start Free TrialLog in
Avatar of motioneye
motioneyeFlag for Singapore

asked on

bcp command failed

Hi,
I has run bcp command as below in cmd prompt.

bcp "externalFF.tempsn" out "tempsnxx.txt" -c -q -U"sa" -P"BruderX4$",

however it return with error msg as below, I had run this at CMD windows in the server that run the database engine.

SQLState = S0002, NativeError = 208
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'externalFF
.tempsn'.
Avatar of Aneesh
Aneesh
Flag of Canada image

bcp dbName.owner.TableName  out  completepath\Filename  -c -q  -Usa -PBruderX4$

here is an example

BCP Northwind.dbo.Categories out c:\categories.txt -n -Smyservername -Usa -PBruderX4$
I missed to specify the servername in your query

bcp dbName.owner.TableName  out  completepath\Filename  -c -q  -Usa -PBruderX4$ -Smyservername
Avatar of motioneye

ASKER

Hi,
How could I use this file agaib to get it insert into other tables?? how do I use bcp insert here?
You can do this in the following way, you need to replace the 'out' with 'in', in your above query

BCP Northwind.dbo.Categories in c:\categories.txt -c -Smyservername  -Uusername - Ppassword
Ok,
I got it, so mean to get it transfer to another table that have same column and data type, I should not define the indexes or any constraints earlier, this has to be done right after the data was bcp in...

am I rite???
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
Thanks for Grade 'B'

Please re-read the EE Guidelines regarding grading Standards at:

What's the right grade to give?
https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/help.jsp#hi73

And in particular this section:

<quote>
C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.
Remember, the Expert helping you today is probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support. It's also true that a "C" is the lowest grade you can give, and the Experts know that -- so use it judiciously.

Only the Moderators and Page Editors have the choice to give a D grade. Beyond that, in a practical sense, the grading guidelines have "softened" a bit over the last year or two; one might expect that the majority of grades would be Bs (a standard "bell" curve), but the fact is that the culture of the site has caused there to be an inordinately high percentage of As. The Moderators have been instructed to ensure that the As they award are actually "Excellent" answers. Similarly, the C grade is the lowest that can be given by a member, a fact which should be kept in mind when grading as well.

The use of a C in a vindictive manner is likely to be changed by a Moderator. You may not like the answer you get, and in some cases, and you may not like the way it is delivered, but if it is deemed to be accurate, no less than a B is an acceptable grade.