Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Stored Procedure

Author  Topic 

dewacorp.alliances

452 Posts

Posted - 2006-10-31 : 22:36:55
[code]...
...
...
DBCC CHECKDB('NOFINTR01_dbCorpCardData_2001_DRT') WITH NO_INFOMSGS

RETURN(0)

EXIT_ERROR:
SET @sMsg = CAST(GETDATE() as varchar(20)) + ' - ' + OBJECT_NAME(@@PROCID) + ', - ' + @sMsg
RAISERROR('%s (%d)', 16, 1, @sMsg, @iErr)
RETURN(@iErr)
GO[/code]

Hi all
I've created this stored procedure for restoring backup and at the end of it, I do the DBCC stuff.

So if there is an error on that DBCC will it return 0 anyway which means successfull? Is there anyway to trap this (if the DBCC return an error) and go to EXIT_ERROR ?

Thanks
   

- Advertisement -