Home All Groups Group Topic Archive Search About

Unable to open bcp host file or Can't the path of data file.

Author
7 Oct 2005 9:16 PM
Naana via SQLMonster.com
Hi,

I'm trying to Bulk copy a dat file into my SQL table through a BCP or Bulk
Copy and I get the error messages above, but when I use DTS and points it to
the same path it works. Why isn't BCP and BULK Copy working for me.

e.g.1:

BULK INSERT DBA..publisher FROM 'c:\newpubs.dat'
WITH (
   DATAFILETYPE = 'char',
   FIELDTERMINATOR = ',',
   ROWTERMINATOR = '\n'
)

e.g.2:

C:\>bcp DBA.dbo.Publisher In 'c:\newpubs.dat -c -t, -r\n -Sserver -Uuserid
-Ppassword



Author
7 Oct 2005 9:24 PM
Nils Wolf
try

C:\>bcp DBA..Publisher In
c:\newpubs.dat -c -t',' -r\n -Sserver -Uuserid -Ppassword


Nisse





"Naana via SQLMonster.com" <u14055@uwe> schrieb im Newsbeitrag
news:557fe8fea1c19@uwe...
Show quoteHide quote
> Hi,
>
> I'm trying to Bulk copy a dat file into my SQL table through a BCP or Bulk
> Copy and I get the error messages above, but when I use DTS and points it
> to
> the same path it works. Why isn't BCP and BULK Copy working for me.
>
> e.g.1:
>
> BULK INSERT DBA..publisher FROM 'c:\newpubs.dat'
> WITH (
>   DATAFILETYPE = 'char',
>   FIELDTERMINATOR = ',',
>   ROWTERMINATOR = '\n'
> )
>
> e.g.2:
>
> C:\>bcp DBA.dbo.Publisher In 'c:\newpubs.dat -c -t, -r\n -Sserver -Uuserid
> -Ppassword
>
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200510/1
Are all your drivers up to date? click for free checkup

Author
11 Oct 2005 7:13 PM
Naana via SQLMonster.com
Hi Nil,

The BCP is still not working it gives me an error message "Unable to open BCP
host data file".

I used Bulk Insert and I get a "Bulk insert data conversion error (type
mismatch) for row 1, column 7 (EventDate). The trigger at the end of the
statement is suppose to change the data type, but doesn't work when Bulk
Insert .

e.g:
BULK INSERT PUBS.dbo.[Eventheader]
   FROM 'c:\abc.txt'
   WITH
     (
       FIELDTERMINATOR = ',',
        ROWTERMINATOR = ':\n',
        FIRE_TRIGGERS
      )




Nils Wolf wrote:
>try
>
>C:\>bcp DBA..Publisher In
>c:\newpubs.dat -c -t',' -r\n -Sserver -Uuserid -Ppassword
>
>Nisse
>
>> Hi,
>>
>[quoted text clipped - 16 lines]
>> C:\>bcp DBA.dbo.Publisher In 'c:\newpubs.dat -c -t, -r\n -Sserver -Uuserid
>> -Ppassword


Author
12 Oct 2005 5:25 PM
Nils Wolf
can you post some lines of your abc.txt  (inkl. Line 1)


Nils


"Naana via SQLMonster.com" <u14055@uwe> schrieb im Newsbeitrag
news:55b1205d87cfa@uwe...
Show quoteHide quote
> Hi Nil,
>
> The BCP is still not working it gives me an error message "Unable to open
> BCP
> host data file".
>
> I used Bulk Insert and I get a "Bulk insert data conversion error (type
> mismatch) for row 1, column 7 (EventDate). The trigger at the end of the
> statement is suppose to change the data type, but doesn't work when Bulk
> Insert .
>
> e.g:
> BULK INSERT PUBS.dbo.[Eventheader]
>   FROM 'c:\abc.txt'
>   WITH
>     (
>       FIELDTERMINATOR = ',',
>        ROWTERMINATOR = ':\n',
>        FIRE_TRIGGERS
>      )
>
>
>
>
> Nils Wolf wrote:
>>try
>>
>>C:\>bcp DBA..Publisher In
>>c:\newpubs.dat -c -t',' -r\n -Sserver -Uuserid -Ppassword
>>
>>Nisse
>>
>>> Hi,
>>>
>>[quoted text clipped - 16 lines]
>>> C:\>bcp DBA.dbo.Publisher In
>>> 'c:\newpubs.dat -c -t, -r\n -Sserver -Uuserid
>>> -Ppassword
>
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200510/1
Author
17 Oct 2005 4:20 PM
Naana via SQLMonster.com
Hi Nil,

It works now, because I had to clean the code's on the txt file.

Thanks.

Nils Wolf wrote:
Show quoteHide quote
>can you post some lines of your abc.txt  (inkl. Line 1)
>
>Nils
>
>> Hi Nil,
>>
>[quoted text clipped - 30 lines]
>>>> 'c:\newpubs.dat -c -t, -r\n -Sserver -Uuserid
>>>> -Ppassword


--
Message posted via http://www.sqlmonster.com



Post Thread options