Hi all,
I have a problem with the xp_cmdshell stored procedure on SQL Server
2005.
I've allowed its execution on the databases which require it, using
the sp_configure 'show advanced options' and sp_configure
'xp_cmdshell' commands.
It works fine most of the time, but sometimes, it simply stops
running, whatever command I am trying to run (notepad, dir c:, ...).
In the Management Studio, the execution returns NULL, and nothing
happens. There is no error message, and I've also checked that both
the 'show advanced options' and 'xp_cmdshell' configuration variables
are still set to '1'.
I've experienced this problem twice, it seems to last a few hours, and
then disappears.
Does anyone have an idea about why SQL Server is unable to run an
external program using xp_cmdshell?
Thank you!
--
Romain
Aaron Bertrand [SQL Server MVP] - 11 Mar 2008 11:24 GMT
> It works fine most of the time, but sometimes, it simply stops
> running, whatever command I am trying to run (notepad, dir c:, ...).
You cannot run notepad from xp_cmdshell... it will never return. You should
not run *any* program that *might* raise any sort of graphical GUI or
prompt... this includes error message dialogs. xp_cmdshell is meant for
command-line interfaces only.
A
romain.larmet@gmail.com - 11 Mar 2008 11:40 GMT
On 11 mar, 11:24, "Aaron Bertrand [SQL Server MVP]"
<ten....@dnartreb.noraa> wrote:
> > It works fine most of the time, but sometimes, it simply stops
> > running, whatever command I am trying to run (notepad, dir c:, ...).
[quoted text clipped - 5 lines]
>
> A
Ok, thanks for the tip :-)
So I need to add that the application I am trying to run using
xp_cmdshell is not a GUI application.
But anyway, the basic test "dir c:" should always work and sometimes
it doesn't.
Regards