如果索引不存在则创建索引
如果 sql 查询不存在索引,我在使用 Advantage 数据库服务器创建索引时遇到问题。
我的查询如下所示:
If not Exists(<SELECT Query for amount of indizes for one column>) then
Create Index Test on Tablename (No); endif
所以我不使用 FullTextSearchIndizes,因为它是一个整数字段。否则它看起来像这样:
If not Exists(SELECT * FROM tablename WHERE CONTAINS( * , 'Test' )) then
Create Index Test on Tablename (Name) Content; endif
所以,我唯一的问题是如何获取索引。我在其他 DBMS 中读到过,您可以使用 sys.indexes 和其他一些东西。
I have a problem creating an index with the advantage database server if it doesn't exist with a sql query.
My query looks like this:
If not Exists(<SELECT Query for amount of indizes for one column>) then
Create Index Test on Tablename (No); endif
So I don't use FullTextSearchIndizes,because it is a integer field. Otherwhise it would look like this:
If not Exists(SELECT * FROM tablename WHERE CONTAINS( * , 'Test' )) then
Create Index Test on Tablename (Name) Content; endif
So, my only problem is how do I get the indices. I've read in other DBMS you can use sys.indexes
and some other things.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看系统表:
https://devzone.advantagedatabase.com/dz /webhelp/Advantage10/devguide_system_tables.htm
特别是有一个名为
system.indexes
的表:https://devzone.advantagedatabase.com/dz/webhelp/Advantage10/master_system_indexes.htm
Take a look at the System tables:
https://devzone.advantagedatabase.com/dz/webhelp/Advantage10/devguide_system_tables.htm
In particular there is a table called
system.indexes
:https://devzone.advantagedatabase.com/dz/webhelp/Advantage10/master_system_indexes.htm
利用系统命令尝试类似这样的操作。这是我在 Advantage 数据库上使用的一个工作示例:
Try something more like this, utilizing the system commands. This is a working example I use on an Advantage Database: