問(wèn)題描述
我注意到,當(dāng)我查詢(xún) dbo.sysobjects 時(shí),為了確定我的數(shù)據(jù)庫(kù)中的所有對(duì)象,它還會(huì)選取名稱(chēng)以syncobj_"開(kāi)頭的所有系統(tǒng)視圖.它們的 xtype 為V",除了檢查視圖名稱(chēng)外,我似乎無(wú)法知道這些是系統(tǒng)視圖,而不是我自己的視圖.還有其他方法嗎?我想從我正在創(chuàng)建的查詢(xún)中排除這些.
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.
推薦答案
參見(jiàn) OBJECTPROPERTY
:
IsMSShipped
IsMSShipped
任何模式范圍的對(duì)象
在安裝 SQL Server 期間創(chuàng)建的對(duì)象.1 = 真 0 = 假
Object created during installation of SQL Server. 1 = True 0 = False
像這樣使用它:
SELECT * from sysobjects where OBJECTPROPERTY(ID,N'IsMSShipped') = 0
雖然它的文檔有點(diǎn)偏離 - 它還可以幫助您排除by"添加的其他對(duì)象.SQL Server 稍后也 - 例如任何與復(fù)制相關(guān)的對(duì)象也被視為 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
.
這篇關(guān)于SQL Server - 查詢(xún)系統(tǒng)對(duì)象的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!