This is tricky, I always have to look it up in my notes:


SET VAR vTableID = sys_table_id from sys_tables where sys_table_name = ' ...... 
'
SET VAR vIndexName = sys_index_name from sys_indexes where sys_table_id = 
.vTableID and sys_column_name = ' .... '
ALTER TABLE <tablename> DROP CONSTRAINT &vIndexName

This will work in the simple case (where the column is included in 
one-and-only-one index) but has the potential to fail (by removing the wrong 
index) if the column participates in more than one index.
You could detect this with:
SELECT MAX(sys_index_name), COUNT(*) INTO vIndexName, vCount FROM sys_indexes 
where sys_table_id = .vTableID and sys_column_name = ' .... ' GROUP BY 
sys_index_name
and then checking vCount to ensure it's greater than 1.  If so, you shouldn't 
delete the index because there are multiple candidates.--
Larry   

-- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to