Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 2nd, 2004, 07:37 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Out-put from Stored procedure

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







Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure muthu555 SQL Server 2000 1 March 5th, 2007 07:13 AM
Stored Procedure jezywrap SQL Server ASP 1 January 3rd, 2007 12:29 AM
stored procedure kdm260 SQL Server 2000 2 June 19th, 2006 04:45 PM
Help About Stored Procedure zhuge6 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 20th, 2005 09:27 AM
Stored Procedure... babloo81 SQL Server 2000 2 May 1st, 2004 11:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.