Link to home
Start Free TrialLog in
Avatar of tl121000
tl121000Flag for United States of America

asked on

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

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.
Avatar of MohammedU
MohammedU
Flag of United States of America image

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"
Avatar of tl121000

ASKER

same result - the user definitely has rights...
 
I tried sql authentication and windows authentication account - neither worked.
Did you try to connect with Query analyser?
Are you connecting locally if not try it on the server using Query analyzer...
Local SQL database -
Make sure the Login has the access to the database.
ASKER CERTIFIED SOLUTION
Avatar of tl121000
tl121000
Flag of United States of America 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