TheBugSlayer
Programmer
Hello all,
It's been a while.
I am trying to export a table using the bcp utility. Below is the command I am running in SSMS:
which returns the following error
that looks like this
Checking the environment variables, I found that the path to the Sybase bcp.exe executable was recorded but SQL Server's one is not. So I went ahead and added the path
However, the xp_cmdshell execution is still failing. Adding the full path to bcp.exe in the xp_cmdshell statement complains about it.
What change do I need to make for this command to run?
PS: I have run this statement just to make sure it is not a permission issue and it ran just fine
THANK YOU!
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA), Training HOTT cert SQL Server 2012 Business Intelligence (SSIS, SSAS).
It's been a while.
I am trying to export a table using the bcp utility. Below is the command I am running in SSMS:
Code:
exec master..xp_cmdshell 'bcp "SELECT Col1 FROM MyTable" out E:\Projects\Reports\mytable.txt -c -T -SMyServer'
which suggests that the bcp.exe being used is the Sybase's one as confirmed by the output of the MS-DOS commandSSMS said:Password:
CTLIB Message: - L1/O1/S1/N138/1/0:
: user api layer: external error: A data length of 255 exceeds the maximum length allowed for password data.
Setting connection properties failed.
NULL
Code:
c:\users\myuser\where bcp
MS-DOS said:c:\sybse\ocs-15_0\bin\bcp.exe
Checking the environment variables, I found that the path to the Sybase bcp.exe executable was recorded but SQL Server's one is not. So I went ahead and added the path
to the environment variables and now "where bcp" returnsD:\Program Files\Microsoft SQL Server\110\Tools\Binn
D:\Program Files\Microsoft SQL Server\110\Tools\Binn\bcp.exe
C:\Sybase\OCS-15_0\bin\bcp.exe
However, the xp_cmdshell execution is still failing. Adding the full path to bcp.exe in the xp_cmdshell statement complains about it.
What change do I need to make for this command to run?
PS: I have run this statement just to make sure it is not a permission issue and it ran just fine
Code:
exec master..xp_cmdshell 'dir "\\dbrepository\reports" /s/b > E:\Projects\Reports\test_path.txt';
THANK YOU!
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA), Training HOTT cert SQL Server 2012 Business Intelligence (SSIS, SSAS).