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
 SQL Server Administration (2000)
 dbcc checkdb return code

Author  Topic 

gam
Starting Member

9 Posts

Posted - 2005-01-04 : 14:26:01
Does dbcc checkdb return a return code? I'd like to use it in a proc within a job(examples in this forum). I'd like to determine if errors were found without scanning the output. And send a notification if an error is found. Is this possible? Or is there another way to handle this?

gam
Starting Member

9 Posts

Posted - 2005-01-04 : 15:40:45
I think @@error should work.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-01-04 : 15:52:56
I just schedule the stored procedure in SQL Agent and have a failure notification set on the job. When DBCC CHECKDB fails, the job fails thus sending pages to the DBAs.

Tara
Go to Top of Page

gam
Starting Member

9 Posts

Posted - 2005-01-05 : 07:54:31
I've used a version of your procedure in a job. And I have a notification set. But how does the job know that the CHECKDB has failed, and thus the procedure, without some sort of return code being set?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-01-05 : 12:24:40
I would assume through @@ERROR. But I'm not positive on that.

Tara
Go to Top of Page
   

- Advertisement -