SQL Server Help - Sajha Mobile
SAJHA MOBILE
SQL Server Help
Posts 4 · Viewed 3462 · 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 9 · Viewed 12645 · Likes 1
· Posts 7 · Viewed 4083 · Likes 1
· Posts 1 · Viewed 1114
· Posts 1 · Viewed 1123
· Posts 1 · Viewed 1020
· Posts 1 · Viewed 1109
· Posts 1 · Viewed 1075
· Posts 21 · Viewed 10195 · Likes 1
· Posts 3 · Viewed 2659
· Posts 5 · Viewed 7845 · Likes 1



Your Banner Here
Travel Partners
Travel House Nepal