SQL Server Help - Sajha Mobile
SAJHA MOBILE
SQL Server Help
Posts 4 · Viewed 5362 · Go to Last Post
Chintamani
· Snapshot
Like · Likedby · 0

Hey guys

I am trying to use a BCP command on SQLSERVER 2005. I am getting some problem regarding it.

if I type the below code on command prompt

Bcp AdventureWorks.Sales.Currency out "c:\abc.txt" -c -T

Then the abc.txt is created on the C drive with all the values from that table.

but if I use my own table and write

Bcp test.dbo.tempInfo out "c:\abcd.txt" -c -T

then I will get this error
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Native Client] [Sql server] login failed for user 'Chintamani\Chintamani'.

SQLState = 42000, NativeError = 4060
Error = [Microsoft][SQL Native Client] [Sql server] cannot open database "test" requested by the login. The login failed


Any help will be appreciated.

Chintamani
· Snapshot
Like · Liked by · 0

Sorry Guys

      I was just a punk. I got it now.

I would clarify how I got it. I had two instances one was just Chintamani and another was Chintamani/Chintamani.

I had that AdventureWorks database on both of my instances but the test on later case.

So when I run the first BCP command it was using my first instance and executing that and similarly when I use second BCP command it was searching on my first instance and giving the error message. So I added the servername "-S Chintamani/Chintamani" on that command and now it is working.

Thank you guys for your time.

Brain Malfunction
· Snapshot
Like · Liked by · 0

ye lau.. bhanesi kuro tesopo parecha

Kalopoolbasi
· Snapshot
Like · Liked by · 0

Hi Chintamani,

I have a similar problem. I am supposed to copy the result of a query into a flat file. After looking at your problem/solution, I tried the following:

 

Bcp Select.....From....Where..... out "c:\abc.txt" -c -T

Then I got the error:

Msg 102, Level 15, State 1, Line 12

Incorrect syntax near 'out'.

How should I get it to work?

Thanks

 

Last edited: 09-Aug-08 11:17 PM
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 16 · Viewed 3372 · Likes 3
· Posts 1 · Viewed 695 · Likes 3
· Posts 1 · Viewed 508 · Likes 3
· Posts 8 · Viewed 1450 · Likes 3
· Posts 1 · Viewed 358
· Posts 11 · Viewed 1151
· Posts 1 · Viewed 139
· Posts 8 · Viewed 555
· Posts 18 · Viewed 481
· Posts 1 · Viewed 97



Travel Partners
Travel House Nepal