[Emerald] CheckDatabase

David Routh ( drouth@davlin.net )
Mon, 22 Nov 1999 09:39:48 -0600

Hello,

About a week ago I changed the CheckDatabase Stored Procedure to the
checkdb.sql procedure. This was on advice that the checkdb.sql provided a
better procedure than the original CheckDatabase (from insttask.sql)...

Anyway, here's how the new CheckDatabase. The Application log says it
fails on Step 1...... can someone tell me what's happening?

Thanks, David

CREATE PROC CheckDatabase AS
DBCC CheckDB(Emerald)

DBCC NewAlloc

DECLARE @query VARCHAR(100)
SELECT @query = "DBCC UpdateUsage("+ DB_NAME() + ")"
EXEC (@query)

DBCC CheckIdent(Actions)

DBCC CheckIdent(Charges)

DBCC CheckIdent(ChargeTypes)

DBCC CheckIdent(ClassDates)

DBCC CheckIdent(Classes)

DBCC CheckIdent(Credits)

DBCC CheckIdent(Domains)

DBCC CheckIdent(ExternalSystems)

DBCC CheckIdent(ExternalTrans)

DBCC CheckIdent(Groups)

DBCC CheckIdent(Incidents)

DBCC CheckIdent(InvoiceItems)

DBCC CheckIdent(Invoices)

DBCC CheckIdent(Mail)

DBCC CheckIdent(MasterAccounts)

DBCC CheckIdent(Payments)

DBCC CheckIdent(RadATConfigs)

DBCC CheckIdent(RadConfigs)

DBCC CheckIdent(Rates)

DBCC CheckIdent(Reports)

DBCC CheckIdent(Scripts)

DBCC CheckIdent(Servers)

DBCC CheckIdent(SubAccounts)

DECLARE @tablename varchar(30)
DECLARE @tablename_header varchar(75)
DECLARE tnames_cursor CURSOR FOR SELECT name FROM sysobjects WHERE type =
'U'
OPEN tnames_cursor
FETCH NEXT FROM tnames_cursor INTO @tablename
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
SELECT @tablename_header = "Updating " +
RTRIM(UPPER(@tablename))
PRINT @tablename_header
EXEC ("UPDATE STATISTICS " + @tablename )
END
FETCH NEXT FROM tnames_cursor INTO @tablename
END
PRINT " "
PRINT " "
SELECT @tablename_header = "************* NO MORE TABLES"
+ " *************"
PRINT @tablename_header

PRINT " "
PRINT "Statistics have been updated for all tables."
DEALLOCATE tnames_cursor

For more information about this list (including removal) go to:
http://www.iea-software.com/support/maillists/liststart