Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXEC master..xp_cmdshell - error not recognized as an 1

Status
Not open for further replies.

snoopyyu

Programmer
Jan 9, 2004
12
US
Hi,

I have trying to execute the following command in my Query Analyzer:

EXEC master..xp_cmdshell 'bcp "SELECT * FROM pubs..authors" queryout \\Ny2_alextest5\ConnectionPolinska\authors.txt -U sa -P -c'

This is working in my first machine. But when I run it in the second machine, I got the following error:

The name specified is not recognized as an
internal or external command, operable program or batch file.

Any ideas? Thanks in advance.

Snoopy
 
One thought...you might want to make sure that the user logged on to the second machine has access to both directories.


-MK
 
Thanks. I have verified already that all the paths are accesible from the second machine.
 
Hi snoopyyu: thank you. Can you tell me the commands for bcp or bulk insert. I only know bcp and bulk insert are for transferring data between data file and sql server, I don't know how to do between tables.
thanks
 
Can you manually run bcp from all directories (only need to try 2) on the second machine?
 
rdroske: Yes, I can manually run bcp from command prompt in any directories, but getting error just when running inside xp_cmdshell in Query Analyzer.

gzm219: Not sure if the following is what you are looking for:

BULK INSERT Northwind.dbo.[Order Details]
FROM 'f:\orders\lineitem.tbl'
WITH
(
FIELDTERMINATOR = '|',
ROWTERMINATOR = '|\n'
)

 
Odd, does the same thing happen when trying to run programs other than bcp?

Also the rights of the user logged on are not what would matter, it the account that the SQL services run under that
counts. Are the SQL Server Service and the SQL Agent service running under the same account on both machines and do those accounts have the rights needed?

Rights for xp_cmdshell are explained at

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top