SQL Server:我应该在sys表上使用information_schema表吗? [英] SQL Server: should I use information_schema tables over sys tables?

查看:192
本文介绍了SQL Server:我应该在sys表上使用information_schema表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SQL Server中,有两种元数据架构:

In SQL Server there is two schemas for metadata:

  • INFORMATION_SCHEMA
  • SYS

我听说INFORMATION_SCHEMA表是基于ANSI标准的.开发时存储过程,在sys表之上使用INFORMATION_SCHEMA表是否明智?

I have heard that INFORMATION_SCHEMA tables are based on ANSI standard. When developing e.g. stored procedures, should it be wise to use INFORMATION_SCHEMA tables over sys tables?

推荐答案

在直接查询sys模式时,我总是会尝试使用Information_schema视图.

I would always try to use the Information_schema views over querying the sys schema directly.

视图符合ISO,因此从理论上讲,您应该能够轻松地在不同的RDBMS之间迁移任何查询.

The Views are ISO compliant so in theory you should be able to easily migrate any queries across different RDBMS.

但是,在某些情况下,我所需的信息只是在视图中不可用.

However, there have been some cases where the information that I need is just not available in a view.

我提供了一些链接,其中包含有关视图和查询SQL Server目录的更多信息.

I've provided some links with further information on the views and querying a SQL Server Catalog.

http://msdn.microsoft.com/en-us/library/ms186778.aspx

http://msdn.microsoft.com/en-us/library/ms189082.aspx

这篇关于SQL Server:我应该在sys表上使用information_schema表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆