SQL Server - Querying sysobjects(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 - 查询系统对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL Server - 查询系统对象


基础教程推荐
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01