HiveBrain v1.2.0
Get Started
← Back to all entries
gotchasqlMinor

Why does 'sysfiles1' show up in the sys.objects catalog view in SQL Server 2008?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
showwhythe2008objectssqlviewsysfiles1sysdoes

Problem

We were recently using this query to find tables in our database that didn't have clustered indexes and found that one of the results it reported back was the 'sys.sysfiles1' table. We're running SQL Server 2008 and I was under the impression that this table wasn't used anymore (as some answers have pointed out there seems to be a misconception that this table only exists for databases upgraded from SQL Server 2000). Furthermore, I'm not able to directly select anything out of the sys.sysfiles1 table (though I am able to select directly out of the sys.sysfiles view).

Running the following to create a fresh database against a local installation of SQL Server 2008 (@@version = Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64), though we've seen it on our production instance of SQL Server 2008 as well) illustrates what I mean:

CREATE DATABASE SysFilesTesting
--returns a row:
SELECT * FROM SysFilesTesting.sys.objects where name = 'sysfiles1'
--throws 'invalid object name' error:
SELECT * FROM SysFilesTesting.sys.sysfiles1


Why is sys.objects reporting the existence of a sysfiles1 table?

Solution

There are lots of them

SELECT * FROM sys.objects where name LIKE 'sys%'


These really are objects in your databases

Internally, other useful objects like sys.objects don't actually exist in your database.

Code Snippets

SELECT * FROM sys.objects where name LIKE 'sys%'

Context

StackExchange Database Administrators Q#10146, answer score: 5

Revisions (0)

No revisions yet.