Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating index if index doesn't exist

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.

like image 745
André Dziurla Avatar asked Dec 08 '25 19:12

André Dziurla


1 Answers

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

like image 82
Jens Mühlenhoff Avatar answered Dec 11 '25 11:12

Jens Mühlenhoff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!