Whenever I execute 'bcp' in Command Prompt or in xp_cmdshell such as
exec xp_cmdshell 'bcp '
It gives me generic usage message like
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character type]
[-N keep non-text native] [-6 6x file format] [-q quoted identifier]
[-C code page specifier] [-t field terminator] [-r row terminator]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values]
[-h "load hints"]
EXCEPT in one server where I get the error below when executed through
xp_cmdshell (works fine in Command Prompt)
'bcp' is not recognized as an internal or external command,
operable program or batch file.
NULL
I am not using any account to run the SQL Server services.
Anyone, any idea?
Regards,
MZeeshan
You're going to need to give SQL Server more info to go on.
> exec xp_cmdshell 'bcp '
You need to specify "in","out",where the file is, etc. That's what the
generic message is telling you.
"MZeeshan" <mzeeshan@.community.nospam> wrote in message
news:3980BBF1-688F-48EB-9BE3-7EBF6DFB0B4C@.microsoft.com...
> Whenever I execute 'bcp' in Command Prompt or in xp_cmdshell such as
> exec xp_cmdshell 'bcp '
> It gives me generic usage message like
> usage: bcp {dbtable | query} {in | out | queryout | format} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n native type] [-c character type] [-w wide character type]
> [-N keep non-text native] [-6 6x file format] [-q quoted identifier]
> [-C code page specifier] [-t field terminator] [-r row terminator]
> [-i inputfile] [-o outfile] [-a packetsize]
> [-S server name] [-U username] [-P password]
> [-T trusted connection] [-v version] [-R regional enable]
> [-k keep null values] [-E keep identity values]
> [-h "load hints"]
> EXCEPT in one server where I get the error below when executed through
> xp_cmdshell (works fine in Command Prompt)
> 'bcp' is not recognized as an internal or external command,
> operable program or batch file.
> NULL
> I am not using any account to run the SQL Server services.
> Anyone, any idea?
> --
> Regards,
> MZeeshan
|||I was just trying to give the simplest of the bcp options. Here, I was just
trying to explain there is some PATH issue in the shell when bcp is executed
from xp_cmdshell.
Regards,
MZeeshan
"ChrisR" wrote:
> You're going to need to give SQL Server more info to go on.
> You need to specify "in","out",where the file is, etc. That's what the
> generic message is telling you.
>
> "MZeeshan" <mzeeshan@.community.nospam> wrote in message
> news:3980BBF1-688F-48EB-9BE3-7EBF6DFB0B4C@.microsoft.com...
>
>
|||May be the binn (example: C:\Program Files\Microsoft SQL
Server\80\Tools\BINN) directory is not in the os variable "path" and
xp_cmdshell is trying to execute the cmd from another dir.
AMB
"MZeeshan" wrote:
> Whenever I execute 'bcp' in Command Prompt or in xp_cmdshell such as
> exec xp_cmdshell 'bcp '
> It gives me generic usage message like
> usage: bcp {dbtable | query} {in | out | queryout | format} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n native type] [-c character type] [-w wide character type]
> [-N keep non-text native] [-6 6x file format] [-q quoted identifier]
> [-C code page specifier] [-t field terminator] [-r row terminator]
> [-i inputfile] [-o outfile] [-a packetsize]
> [-S server name] [-U username] [-P password]
> [-T trusted connection] [-v version] [-R regional enable]
> [-k keep null values] [-E keep identity values]
> [-h "load hints"]
> EXCEPT in one server where I get the error below when executed through
> xp_cmdshell (works fine in Command Prompt)
> 'bcp' is not recognized as an internal or external command,
> operable program or batch file.
> NULL
> I am not using any account to run the SQL Server services.
> Anyone, any idea?
> --
> Regards,
> MZeeshan
|||I have checked the path is present in the PATH variable in System Variables.
Plus, I can run bcp in Command Prompt
Regards,
MZeeshan
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> May be the binn (example: C:\Program Files\Microsoft SQL
> Server\80\Tools\BINN) directory is not in the os variable "path" and
> xp_cmdshell is trying to execute the cmd from another dir.
>
> AMB
> "MZeeshan" wrote:
|||Can you run this statement from QA?
exec master..xp_cmdshell 'path && cd'
> I have checked the path is present in the PATH variable in System Variables.
> Plus, I can run bcp in Command Prompt
How are accesing the command prompt?
AMB
"MZeeshan" wrote:
[vbcol=seagreen]
> I have checked the path is present in the PATH variable in System Variables.
> Plus, I can run bcp in Command Prompt
> --
> Regards,
> MZeeshan
>
> "Alejandro Mesa" wrote:
|||Thanks... this indeed worked.
What I found out that due to re-installation of SQL Server, the path
'c:\program files..\binn' has been pushed to the end and it was not appearing
in the xp_cmdshell 'path'.
Once the change was made, I had to reboot the server (just merely
stopping/restarting SQL server didn't help).
It's fine now!!!
Regards,
MZeeshan
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> Can you run this statement from QA?
> exec master..xp_cmdshell 'path && cd'
>
> How are accesing the command prompt?
>
> AMB
> "MZeeshan" wrote:
没有评论:
发表评论