【发布时间】:2011-09-30 10:02:08
【问题描述】:
我正在尝试使用 SQL Server 管理对象 (SMO) 检索索引上的扩展属性,但检索到的 SMO 对象有一个空的 ExtentedProperties 集合。 (索引在表上。)扩展属性在那里,我在 T-SQL 中检查。此外,扩展属性,例如SMO 找到数据库对象。我所做的只是
Server s = new Server(<connectionObj>);
Database db = s.Databases[<databaseName>];
int extCount = db.Tables[<tableName>]
.Indexes[<indexName>]
.ExtendedProperties
.Count
得到
extCount == 0
我做错了吗?
干杯,
蒂尔曼
PS:这是 SQL Server 2005
【问题讨论】:
-
您的代码看起来正确。您是否 100% 确定您的索引实际上定义了一些扩展属性?
-
谢谢,我只是仔细检查过,所以 select * from fn_listextendedproperty ('MS_Description', 'SCHEMA', 'dbo', 'TABLE', 'T3_Index', 'INDEX', 'PK_T3_Index') 和该属性存在。
标签: .net sql-server smo extended-properties