Question : Could not find a table or object named 'TableName'. Check sysobjects

Well i have an issue when executing a stored procedure to re-index the database which was written by the vendor. Should i run DBCC CHECKTABLE  on sysobjects? Here is the output below. Thanks

DBCC execution completed. If DBCC printed error messages, contact your system administrator.
  ** DBCC DBREINDEX (OrganizationsDesc, '', 0)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
  ** DBCC DBREINDEX (OtherOrders, '', 0)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
  ** DBCC DBREINDEX (SchedPayRptSvcExceptions, '', 0)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
  ** DBCC DBREINDEX (HL7MessageHistory, '', 0)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
  ** DBCC DBREINDEX (TranARdetailBatch44582, '', 0)
Msg 2501, Level 16, State 1, Line 1
Could not find a table or object named 'TranARdetailBatch44582'. Check sysobjects.

Answer : Could not find a table or object named 'TableName'. Check sysobjects

You're not using the same script I gave you.  The script I gave you would have produced this...


DBCC DBREINDEX ('dbo.GLDistOrganizations')

Lets try again:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
DECLARE @TName VARCHAR (255), @Owner VARCHAR(50)
PRINT 'REBUILDING INDEXES FOR TABLES ON '+DB_Name(DB_ID())+'.'
DECLARE TableCurse INSENSITIVE CURSOR FOR
      SELECT su.[NAME],so.[NAME]
      FROM sysobjects so
      JOIN sysusers su
      ON so.uid=su.uid
      WHERE xtype='U'
      and crdate < DATEADD(hh,-6,GETDATE())
      and so.[NAME] NOT LIKE 'tmp%'
      and so.[NAME] NOT LIKE 'temp%'
      and so.[NAME] NOT LIKE 'tblTmp%'
      and so.[NAME] NOT LIKE '%TRACE%'
 
 
 
open TableCurse
      FETCH NEXT FROM TableCurse INTO @Owner, @TName
      WHILE @@FETCH_status=0
      BEGIN
            DECLARE @ExecSTR VARCHAR (255)
            SET @ExecSTR='DBCC DBREINDEX ('''+@Owner + '.' + @TName+''')'
            PRINT '  ** ' + @ExecSTR
            EXEC (@ExecSTR)
            FETCH NEXT FROM TableCurse INTO @Owner, @TName
      END
            CLOSE TableCurse
            DEALLOCATE TableCurse
SET QUOTED_IDENTIFIER OFF
SET ANSI_NULLS ON
Open in New Window Select All
Random Solutions  
 
programming4us programming4us