Solved

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

Posted on 2008-11-01
6
390 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
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 
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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

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…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

688 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