Toad World® Forums

Automatic creation of scripts


#1

Hi everybody,

I am currently trying to make a script to create an index for every single primary key present in a physical model. Obviously, I wish every index to have the same columns as the matching primary key.

But all I have been able to come up with until now is a script creating empty indexes. I miss the code piece adding the index columns. Can anyone help ?

Create_Primary_Key_Indexes.js (1.84 KB)


#2

NewIndexItem.Name = CurrentKeyItem.Name;
Regards,

Vaclav & Mario.

Hi,

modify the AddIndexForKey function and write this:
NewIndexItem.Attribute = CurrentKeyItem.Attribute;
instead of: