Solved

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

Posted on 2008-11-01
6
356 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now