显示标签为“newbie”的博文。显示所有博文
显示标签为“newbie”的博文。显示所有博文

2012年3月19日星期一

BCP newbie question

I am trying to run the bcp utility. When I run it from the command prompt it
works. When I try it from a bat it goes into this crazy endless loop
repeating the command again and again. Any ideas what I am doing wrong?
Regards, Chris.
bcp pubs..publishers out C:\test.txt -c -U****** -P***** -S******
pause
Is your command file by chance named BCP.BAT or BCP.CMD? In that case, it's
calling itself rather than BCP.EXE. You can remedy the problem by
specifying BCP.EXE and/or using a different name for you command file. It's
a good practice to avoid naming command files the same as EXE or command
names.
Hope this helps.
Dan Guzman
SQL Server MVP
"Chris" <123@.123.com> wrote in message
news:OO3%23CBbLGHA.1124@.TK2MSFTNGP10.phx.gbl...
>I am trying to run the bcp utility. When I run it from the command prompt
>it
> works. When I try it from a bat it goes into this crazy endless loop
> repeating the command again and again. Any ideas what I am doing wrong?
> Regards, Chris.
> bcp pubs..publishers out C:\test.txt -c -U****** -P***** -S******
> pause
>

BCP newbie question

I am trying to run the bcp utility. When I run it from the command prompt it
works. When I try it from a bat it goes into this crazy endless loop
repeating the command again and again. Any ideas what I am doing wrong?
Regards, Chris.
bcp pubs..publishers out C:\test.txt -c -U****** -P***** -S******
pauseIs your command file by chance named BCP.BAT or BCP.CMD? In that case, it's
calling itself rather than BCP.EXE. You can remedy the problem by
specifying BCP.EXE and/or using a different name for you command file. It's
a good practice to avoid naming command files the same as EXE or command
names.
Hope this helps.
Dan Guzman
SQL Server MVP
"Chris" <123@.123.com> wrote in message
news:OO3%23CBbLGHA.1124@.TK2MSFTNGP10.phx.gbl...
>I am trying to run the bcp utility. When I run it from the command prompt
>it
> works. When I try it from a bat it goes into this crazy endless loop
> repeating the command again and again. Any ideas what I am doing wrong?
> Regards, Chris.
> bcp pubs..publishers out C:\test.txt -c -U****** -P***** -S******
> pause
>

BCP newbie question

I am trying to run the bcp utility. When I run it from the command prompt it
works. When I try it from a bat it goes into this crazy endless loop
repeating the command again and again. Any ideas what I am doing wrong?
Regards, Chris.
bcp pubs..publishers out C:\test.txt -c -U****** -P***** -S******
pauseIs your command file by chance named BCP.BAT or BCP.CMD? In that case, it's
calling itself rather than BCP.EXE. You can remedy the problem by
specifying BCP.EXE and/or using a different name for you command file. It's
a good practice to avoid naming command files the same as EXE or command
names.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Chris" <123@.123.com> wrote in message
news:OO3%23CBbLGHA.1124@.TK2MSFTNGP10.phx.gbl...
>I am trying to run the bcp utility. When I run it from the command prompt
>it
> works. When I try it from a bat it goes into this crazy endless loop
> repeating the command again and again. Any ideas what I am doing wrong?
> Regards, Chris.
> bcp pubs..publishers out C:\test.txt -c -U****** -P***** -S******
> pause
>

2012年3月8日星期四

BCP fail

Hi,

I'm a newbie to MSQL trying to examine ways in which I can work with a client's data. I'm using the evaluation version of MSQL.

I'm trying to import data from a .dat file created using bcp by the client. The row delimiter is '#'.

I have created a table with the same amount of columns, varchar, 255, nulls allowed. My bcp command is:

bcp dbase_name..table_name in D:\tables\table.dat -n -o D:\tables\error.err -U MyUser -P MyPass -S Myserver

This returns the following error:

SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file

As I understand, this indicates that the format of the destination table is not appropriate for import. However, I am unable to see what further parameters I should specify in the destination table. What have I overlooked?

All help appreciated - thanks for your indulgence.

James TonerI don't know if you ommited this by mistake but if you are using a
row terminator of # then shouldn't also be including -r# in your
bcp in command ?