Solved

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

Posted on 2008-11-01
6
376 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
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 …
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

778 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