views:

29

answers:

3
+2  Q: 

Using System Views

This is a general question that keeps coming to my mind. Is there any major disadvantage in using the SQL Server 2000 system tables in SQL Server 2008? It is a good practice to use system views, but in simple words, Why?

+2  A: 

Yes - they're deprecated and will be removed at some point in time.

If you get used to using the new sys. catalog views now, you won't have to do that later on when the old-style SQL Server 2000 system tables might be gone completely.

Also, in my opinion, it's much easier and more "focused" to

  select * from sys.foreign_keys

than to do something like

  select * from sysobjects where type = 'F'

The intent (selecting data about foreign keys) is more clearly stated, IMO.

marc_s
+2  A: 

In addition to what Marc already said, I'd add that they are also not maintained and not brought up to date for new features, so you may be missing important information.

Remus Rusanu
+1  A: 

From BOL, Catalog views:

We recommend that you use catalog views because they are the most general interface to the catalog metadata and provide the most efficient way to obtain, transform, and present customized forms of this information. All user-available catalog metadata is exposed through catalog views.

The link also says catalog views will maintained across versions and hide the actual tables which can change. Going forward, these are the way to go

gbn
+1 nothing better then a BOL quote :)
Nick Kavadias