July 21, 2008 at 2:21 pm
Hi,
i want to check if the xp_cmdshell option not on then start it.
so i write this syntax and i get an error.why?
THX
if not exists (select name from sys.configurations where name = 'xp_cmdshell' and value_in_use = 1)
(
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
)
July 21, 2008 at 2:27 pm
Try replacing your parentheses with BEGIN and END around your statement block...
July 21, 2008 at 3:05 pm
avipenina (7/21/2008)
so i write this syntax and i get an error.why?THX
this should do it
if not exists (select name from sys.configurations where name = 'xp_cmdshell' and value_in_use = 1)
begin
EXEC sp_configure 'show advanced options', '1'
RECONFIGURE
EXEC sp_configure 'xp_cmdshell', '1'
RECONFIGURE
end
EXEC sp_configure 'show advanced options', '0'
RECONFIGURE
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
July 21, 2008 at 11:25 pm
Thx.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply