問題描述
我注意到,當我查詢 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 - 查詢系統對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!