Solved

BCP  [view] out c:\whatever.txt -c -t, -U [cred] -P[pw] not working

Posted on 2008-11-01
6
386 Views
Last Modified: 2012-06-21
BCP will not work - I can not get a connection - any thoughts?

bcp "server.dbo.view for horizon" out "c:\mytest.txt" -c -t, -U [user] -P [pw]

The user is a a SQl server suthentication account with read access from the view.

SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requ
ested in login 'server'. Login fails.
0
Comment
Question by:tl121000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 15

Expert Comment

by:MohammedU
ID: 22859728
First try to connect to the database with Query Analyzer to make sure your UserID and Password is correct and working fine.
Then
If you are running the BCP command on the server itself then you don't need to use -S parameter if not then use it but it is advisable to use -S parameter all the time...

Try the following code...

bcp "DBname.dbo.view for horizon" out "c:\mytest.txt" -SServerName -c -t, -U "user" -P "pw"
0
 
LVL 9

Author Comment

by:tl121000
ID: 22859899
same result - the user definitely has rights...
 
I tried sql authentication and windows authentication account - neither worked.
0
 
LVL 15

Expert Comment

by:MohammedU
ID: 22859976
Did you try to connect with Query analyser?
Are you connecting locally if not try it on the server using Query analyzer...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Author Comment

by:tl121000
ID: 22861614
Local SQL database -
0
 
LVL 15

Expert Comment

by:MohammedU
ID: 22862146
Make sure the Login has the access to the database.
0
 
LVL 9

Accepted Solution

by:
tl121000 earned 0 total points
ID: 22863895
it does - in other words I have set up an odbc connection using the SQl authentication account and it successfully connects no problem.  the domain admin account does not work either using bcp either
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question