Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 MSDE (2000)
 bcp not working

Author  Topic 

7562
Starting Member

3 Posts

Posted - 2007-05-28 : 11:43:11
I used the BCP utility on SQLServer2000. All tables were copied well.

bcp MyBase.dbo.Clients out d:\ExData\Clients.txt -w -C1251
-S MyServer -U BaseUser -P 1

But when I started The BCP on MSDE it failed.

SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file.

I had granted all rights to the BaseUser.
So, what was my mistake ?
Thanks in advance.

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-05-28 : 12:38:49
Is it named instance? Can you connect to it with other sql tools?
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-05-28 : 15:24:32
Do an master..xp_cmdshell 'dir d:\ExData\' and see if you can see the contents of the folder. The path is relative to the server on which you are executing the script, not the local D drive on our client machine.


Dinakar Nethi
SQL Server MVP
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-05-29 : 01:12:04
quote:
Originally posted by dinakar

Do an master..xp_cmdshell 'dir d:\ExData\' and see if you can see the contents of the folder. The path is relative to the server on which you are executing the script, not the local D drive on our client machine.



this is not true, unless you are executing bcp from within xp_cmdshell.

bcp is a client app - it doesn't have to be run on the server. You can run bcp from your laptop as long as your laptop can connect to the server in question.


www.elsasoft.org
Go to Top of Page

7562
Starting Member

3 Posts

Posted - 2007-05-29 : 08:24:54
I've solved the problem. BCP does not understand long names
(like 'My Documents').
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-05-29 : 10:43:10
it does if you put the path in quotes. args with spaces need to be enclosed in double quotes. That's how cmd line parsing works in NT/XP/2003/Vista. it's only windows 98 and friends that was so "forgiving" on cmd line parsing:

bcp "mydb.dbo.[my table with spaces]" out "c:\folder with spaces\file.txt" -c -T -SMYSERVER


www.elsasoft.org
Go to Top of Page

7562
Starting Member

3 Posts

Posted - 2007-05-29 : 11:41:12
Thank you, Jesse !
I should have guessed.
Go to Top of Page
   

- Advertisement -