Toad World® Forums

Sorting / moving of attributes through scripting

Hi,

I wonder if it’s possible to reorder columns/attriubtes via scripting in TDM. I have a few columns that I wish to have for instance last or first in a table, and the reordering is to be done on a larger number of tables.

Thank you!

Hi Marcus,

thank you for your question. I have made it into a new CR84631, so the answer is no, so far it’s not possible, but we will work on it.

Thanks again!

Regards,
Lukas

Hi,

CR84631 was already fixed and implemented in BETA 4.2.1.4 release.
Enjoy!

Lukas & TDM Team

Can you provide a sample script for previous versions? We cannot upgrade to 4.2.1.4 anytime soon

Thanks

Rangarajan

Hi,

unfortunaly not. We had to modify the application in order to provide the possibility to sort items via scripting. Previous versions cannot be used.

Regards,

Vaclav

I have a hack for part of this:· Basically I wanted to add a column to all indexes (not the PK) on all tables as the first index column – an audit column called load date· This will aid the DBMS in performance in the warehouse environment as the indexes I reverse engineered from source does not have this audit column· Loop through each table and indexo Basically, it first adds the column I want to the index if the column exists in the table and does not already exist in the indexo Create a list of the other items that was originally there, and then goes ahead and removes all these other items o This will leave my audit column intact
o Then I add the columns I listed back making the audit column the first one (I could have reordered them as I insert if I wanted)

o Will work if you want to insert it any position if you adjust the way the loops work § Like removing say the last few, inserting what you want and adding back the old ones§ Or replacing specific columns etc Similar logic can be produced to do resorting the attributes in a table:· Either create a new table with cherry picking the columns to reorder – won’t work if there are foreign keys as you might lose that info or do some elaborate coding to put the FKs back· Not sure if you can read all the attribute’s details for all attributes into local variables and then start reinserting them into the same table in the order needed – again foreign keys etc might cause problems if you delete attributes Thanks

Rangarajan
Insert_Index_Column.txt (6.21 KB)