Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 June 8th, 2006, 01:36 PM
Registered User
 
Join Date: Jun 2006
Location: Sao caetano do sul, sao paul, Brazil.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Danielk
Default bcp

someone knows how to use the bcp utility??
i´m trying to import data from a .txt file, but it´s giving me this error:
[microsoft][odbc sql server driver]unable to open BCP host data - file.

someone can help me??please
urgent..

thanks for everything

 
Old June 9th, 2006, 12:02 AM
Friend of Wrox
 
Join Date: May 2006
Location: Helsingborg, , Sweden.
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i would try to use openrowset function instead. see books online for more information.

 
Old June 9th, 2006, 11:21 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Daniel!

Tell us how txt file was created and how do you insert? Tell us the command line you are using.
The error may be due to incorrect file path too. Or there may be case of improper row and column terminator which you provide with -r and -t switches.

For example -
------------------------------------------------------
bcp "db..employee" out "d:\txt.txt" -c -t"\t" -r"\n" -U"user_name" -P"password" -q
------------------------------------------------------
In this example, if you have Column terminator Tab as -t"\t" and Row terminator as "\n", then you have to 'BCP in' in the same manner. Something like this -
------------------------------------------------------
bcp "db..employee" in "d:\txt.txt" -c -t"\t" -r"\n" -U"user_name" -P"password" -q
------------------------------------------------------

So, open the file, take a look on format and also path of the file. I hope you must have got the point. If you still have same problem, try to configure ODBC also.

Reply if it works or not..

- Som Dutt

 
Old June 12th, 2006, 11:14 AM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also did you look at the file your trying to import? Is the data consistent? Same number of fields per line, etc. Sometimes people try to BCP files that don't meet the requirements of the BCP program. To find out if this is true many times I cut the file into pieces. Perhaps starting with just five rows or so of data.





Similar Threads
Thread Thread Starter Forum Replies Last Post
BCP Error lisa30 SQL Server 2000 5 October 11th, 2007 07:06 PM
BCP out errors, help please. munkee SQL Server 2000 4 August 3rd, 2007 09:14 PM
bcp error SpringSummer SQL Server 2005 1 July 12th, 2007 02:18 AM
BCP Problem rstelma SQL Server 2000 5 October 27th, 2006 06:16 PM
Bcp utility jejyjose SQL Server 2000 1 October 16th, 2003 08:31 AM





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