创建包含列的索引时出现问题 (SQL Server Express)
我正在将 Visual C# 2008 Express Edition 的数据库资源管理器/设计器与 SQL Server Express 2008 一起使用。
我创建了一个表并想要添加索引。但索引将超过 900 字节。一种解决方法是使用索引中包含的列。不幸的是,“包含的列”属性在索引设计器中被禁用,我还没有找到启用它的方法。
有人可以告诉我如何启用该属性吗?是否有另一种方法可以使用设计器将包含的列添加到索引中? SQL Server Express 完全支持此功能吗?
I am using the Database explorer/designer of Visual C# 2008 Express Edition with SQL Server Express 2008.
I created a table and want to add an index. But the index would exceed 900 bytes. One workaround is to use included columns in an index. Unfortunately, the "Included Columns" property is disabled in the Index designer and I haven't found a way to enable it.
Can someone tell me how to enable the property? Is there another way to add included columns to an index using the designer? Is this feature at all supported by SQL Server Express?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要通过在资源管理器中展开表、右键单击“索引”文件夹并选择“添加索引...”来创建索引。执行此操作时请确保表设计器已关闭
You need to create the index by expanding the table in the explorer, right-clicking the Indexes folder and selecting "Add index...". Make sure the table designer is closed when you do this
它肯定支持反对快递。一段时间后,您会发现大多数 GUI 工具都有局限性,值得学习实际语法并直接输入命令。 CREATE INDEX 的语法很容易在 MSDN 上找到,并且它们会通常在备注部分描述任何版本限制。
因此,举例来说,我刚刚针对我的 Express 实例运行了这个,没有出现任何问题:
编辑也,正如其他人提到的,这是一个不寻常的设计。另外,一个限制(可能也是它在 GUI 中被禁用的原因)是您只能在非聚集索引中包含列。稍微思考一下它们是什么,就可以揭示其中的原因。
It's certainly supported against express. After a while, you'll find limitations in most of the GUI tools, it's worth learning the actual syntax, and entering commands directly. The syntax for CREATE INDEX is easily found on MSDN, and they'll normally describe any edition limitations in the remarks section.
So, for instance, I just ran this against my Express instance, without issues:
Edit also, as others have mentioned, this is an unusual design. Also, one limitation (and possibly why it was disabled in the GUI), is that you can only INCLUDE columns in nonclustered indexes. A little thought about what they are should reveal why.