Hi All,
I have a stored procedure that is defined in the following way.
************************************************** ****************
if exists
(select * from sysobjects where id = object_id('RestoreBAKFile'))
drop procedure RestoreBAKFile
go
create procedure dbo.RestoreBAKFile (
@inNewDbName varchar(80),
@inBAKFileSpec varchar(80),
@inOldDbName varchar(80),
@inNewMDFName varchar(80),
@inNewLDFName varchar(80)
)
as
set nocount on
set arithabort on
begin
-- Begin standard var declarations
declare
@procName varchar(100),
@startedTran bit,
@data_file varchar(100),
@log_file varchar(100),
@err int
set @procName = 'RestoreBAKFile'
set @data_file = @inOldDbName + '_data'
set @log_file = @inOldDbName + '_log'
set @startedTran = 0
-- End standard var declarations
--set @outData = null
-- Select data
RESTORE DATABASE @inNewDbName
FROM DISK =
@inBAKFileSpec
WITH FILE = 1,
STATS = 100,
RECOVERY ,
MOVE @data_file
TO
@inNewMDFName,
MOVE @log_file TO
@inNewLDFName
if (@@error <> 0) goto ErrorHandler
goto EOP -- end of procedure
ErrorHandler:
if (@startedTran = 1 and @@trancount > 0) rollback tran
return -1
EOP:
end -- of procedure
go
************************************************** ****************
And when the run the stored procedure my outout is as following.
--------------------------------------------------------------
100 percent restored.
Processed 1016 pages for database 'TestRestore', file 'MSNTVBoxDb_data' on file 1.
Processed 1 pages for database 'TestRestore', file 'MSNTVBoxDb_log' on file 1.
RESTORE DATABASE successfully processed 1017 pages in 0.112 seconds (74.322 MB/sec).
--------------------------------------------------------------
I was wondering of there is way I can capture this output so that I can parse it programatically (with
VB.NET). I am interested in capturing the 'Number of Pages" processed and also the speed (from above example(74.322 MB/sec)).
Any help or pointers is greatly appreciated.
Thanks in Advance
Bala