You may see this error in an ASP page:
Microsoft OLE DB Provider for SQL Server (0x80040E37) Invalid object name 'master.dbo.spt_values'. /<file>.asp, line <line> |
Or in SQL Server:
Server: Msg 208, Level 16, State 1, Line 1 Invalid object name 'master.dbo.spt_values'. |
Make sure you are connecting with a valid user. If you are connecting with a non-privileged user, you may not have access to the table. If you are connecting as sa, try to connect as an administrator via Windows Authentication (trusted connection), and vice-versa.
If you are getting this error while attempting to use Enterprise Manager to connect to your server, then there may be a more serious problem than permissions. See if you can connect with Query Analyzer, again trying both sa through SQL Server authentication and an administrator account using a trusted connection. The result of this will decide your fate:
If you can connect with Query Analyzer Execute the following command:
USE MASTER GO DBCC CHECKDB DBCC NEWALLOC DBCC CHECKCATALOG |
If these report errors, you may have to rebuild the master database (see the bottom section of this article). Otherwise, you can assume that the database itself is okay, and perhaps someone deleted or renamed the spt_values table. So execute the following:
USE MASTER GO DBCC CHECKTABLE('spt_values') |
If this reports any errors, you might try re-installing the latest service pack. If you're not at SP2 or SP3 already, you really should be doing this anyway.
Barring that, in the INSTALL folder of the latest service pack, there is a file called U_TABLES.SQL - you can pull out all of the entries that involve spt_values and run them (an IF EXISTS DROP / CREATE TABLE, two CREATE INDEX statements, a GRANT SELECT to PUBLIC, and many INSERT statements).
If you can't connect with Query Analyzer You can try the following from a command prompt, given the correct path to the latest U_TABLES.SQL file:
| osql -E <path>\U_TABLES.SQL |
If this doesn't work, there is a relatively serious problem. Your options are to rebuild the master database using the rebuildm.exe utility--see the topic 'Rebuild Master' in Books Online or in these MSDN articles:
Rebuild Master How to rebuild the master database (Rebu... Or, to reinstall SQL Server. If you choose to reinstall SQL Server, make sure to detach all user databases first, or you may lose your data. You will also need to re-create any user-defined types that have been placed in master, msdb, tempdb, etc.