SQL Server - 查询系统对象

SQL Server - Querying sysobjects(SQL Server - 查询系统对象)
本文介绍了SQL Server - 查询系统对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,当我查询 dbo.sysobjects 时,为了确定我的数据库中的所有对象,它还会选取名称以syncobj_"开头的所有系统视图.它们的 xtype 为V",除了检查视图名称外,我似乎无法知道这些是系统视图,而不是我自己的视图.还有其他方法吗?我想从我正在创建的查询中排除这些.

I notice that when I query dbo.sysobjects, to determine all the objects in my database, it also picks up all system views whose name starts with 'syncobj_'. These have an xtype of 'V' and there doesn't appear to be any way I can know these are system views, and not my own, except by examining the name of the view. Is there some other way? I would like to exclude these from a query I'm in the process of creating.

推荐答案

参见 OBJECTPROPERTY:

IsMSShipped

IsMSShipped

任何模式范围的对象

在安装 SQL Server 期间创建的对象.1 = 真 0 = 假

Object created during installation of SQL Server. 1 = True 0 = False

像这样使用它:

SELECT * from sysobjects where OBJECTPROPERTY(ID,N'IsMSShipped') = 0

虽然它的文档有点偏离 - 它还可以帮助您排除by"添加的其他对象.SQL Server 稍后也 - 例如任何与复制相关的对象也被视为 IsMSShipped.

It's documentation is a bit off though - it also assists you with excluding other objects added "by" SQL Server at a later date also - e.g. any replication related objects are also considered to be IsMSShipped.

这篇关于SQL Server - 查询系统对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)