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 - 查询系统对象
基础教程推荐
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 在多列上分布任意行 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
