INFORMATION_SCHEMA vs sysobjects

后端 未结 2 1625
时光说笑
时光说笑 2020-12-01 12:24

In SQL Server:

What is the difference between INFORMATION_SCHEMA and sysobjects? Does one provide more information than the other or are they used for different thin

相关标签:
2条回答
  • 2020-12-01 12:53

    The INFORMATION_SCHEMA is part of the SQL-92 standard, so it's not likely to change nearly as often as sysobjects.

    The views provide an internal, system table-independent view of the SQL Server metadata. They work correctly even if significant changes have been made to the underlying system tables.

    You are always much better off querying INFORMATION_SCHEMA, because it hides the implementation details of the objects in sysobjects.

    0 讨论(0)
  • 2020-12-01 12:56

    INFORMATION_SCHEMA is an ANSI standard, somewhat extented in its SQL Server implementation. sysobjects is specific to SQL Server. Old versions of SQL Server did not support it.

    So INFORMATION_SCHEMA is more portable (works on other database) and somewhat easier to use than sysobjects. If it has the information you need, I would go for INFORMATION_SCHEMA.

    sys.objects sysobjects is only there for SQL 2000 portability.

    0 讨论(0)
提交回复
热议问题