Giovanni De Ciantis
Giovanni De Ciantis

Reputation: 367

Use of xp_cmdshell in SQL Server

I am trying to execute a perl script from xp_cmdshell.

The output of the perl script is a csv file, but when I run

EXEC master..xp_cmdshell N'perl G:\script\perl.pl';

I can't find the csv file created, though the xp_cmdshell command seems to run fine, the output is the name of file that has to be created.

I am using xp_cmdshell to create a job step to execute the perl script.

Any help would be appreciated.

Upvotes: 0

Views: 2861

Answers (1)

John Eisbrener
John Eisbrener

Reputation: 672

Since you're running this via a SQL Agent job, it'll be much safer to disable the use of xp_cmdshell via sp_configure (ref1 | ref2) and use a CmdExec job step instead.

When configuring the job step, be sure to go to the advanced page and enable job step logging to a table.

Verbose Logging

This will allow you to better troubleshoot the issues you're having with the perl job in general, as the issue could be related to something entirely outside the context of the database engine.

Upvotes: 1

Related Questions