Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 4th, 2006, 11:01 AM
Registered User
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default BCP Error

Hi,

I am trying to run this bcp from a stored procedure and it wudn't work.
It works fine on command prompt

exec master..xp_cmdshell 'bcp Lisa_Test.dbo.Notfoundtable out C:\Lisa_Test\TelephoneNoNotFound.csv -S office1 -T -o C:\Lisa_Test\NotFoundoutput -e C:\Lisa_Test\NotFounderrfile -t , -c'

It shows this error.

Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file

Is there any server setting to be changed for this ??

Any help please!

Cheers!!



 
Old October 5th, 2006, 07:53 AM
Registered User
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Anyways, don't matter. I figured out.

 
Old October 5th, 2006, 07:57 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

wht was it???

 
Old September 26th, 2007, 05:06 AM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by lisa30
 Anyways, don't matter. I figured out.

Please let me know the solution you figured out!

Thanks A Lot!

Regards
Anubhav
 
Old October 11th, 2007, 06:44 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

one of two things likely going on.

1) the userid that the sql server is running on does not have rights to the file your looking for. Remember that when you connect to the SQL server you use your sql or domain account depending on how you connect. But when you use XPcommand shell you use the domain user that the SQL service is running under. Try logging into the domain on the SQL server box under the id that the SQL server is running under and see if you can see the file.

2) you specify c: But which C: are you looking for. Typically it is safer to specify full paths like \\someserver\someshare\myfile.txt. When you specify c: you need to realize it is not the c: of the client computer, it is the C: of the server, accessed by the user id that the SQL engine is running under.

Hope this helps what you described is a common problem.

Please post if this fixes your problem and if so which issue, 1 or 2.


 
Old October 11th, 2007, 07:06 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also as a troubleshooting step try this..

exec master..xp_cmdshell 'dir C:\Lisa_Test\*.*'

This will tell you what the BCP program can see under the user id that your running under. Make sure you can see the file you want to BCP.

You may be surprised in what you get back.






Similar Threads
Thread Thread Starter Forum Replies Last Post
bcp error SpringSummer SQL Server 2005 1 July 12th, 2007 02:18 AM
BCP Error while importing data from a textfile happygv SQL Server 2000 5 October 6th, 2006 02:07 AM
Error exporting using bcp Pallen SQL Server 2000 0 July 29th, 2006 04:56 AM
bcp Danielk SQL Server 2000 3 June 12th, 2006 11:14 AM
BCP error while importing data from a text file happygv SQL Server ASP 1 December 15th, 2003 09:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.