Toad World Blog

Did you rename a column?

Mar 2, 2011 4:46:00 PM by Vaclav Frolik

In case you renamed a column and do not want to spend too much time by comparing your model with your database, going through the Sync & Convert Wizard etc., take advantage of simple macro that will prepare Alter table xxx rename column command for you (Oracle models only).

Instructions:

  1. Download macro FastColumnRename from our library
     
  2. Import it to Toad Data Modeler
     
    Here you can find an article about how to import custom packages to Toad Data Modeler.
     
  3. Open your model and in Model Explorer right click any attribute and choose Macros -> Column Rename
     
    blog_ren000.png-550x0
     
  4. New dialog opens. Specify new column name. Alter table command will change automatically. Click Execute to rename column in your model and then click Close to close the dialog.
     
        blog_ren001.png-550x0

 

Notes: When you click Execute, the column name will be renamed in your model. Toad Data Modeler will update all related information automatically (indexes, columns in child tables in case the column is a part of alternate key or primary key etc.). On Toad Data Modeler side the operation is safe. But in case the column really is a part of index or alternate key, for example, you will need more complex alter scripts - and in this situation the Sync & Convert Wizard should be used.

Of course, feel free to modify or improve the script. In case you work with another database system you may need different commands.

Good luck,

Vaclav

Tags: Toad Data Modeler Data Modeling

Vaclav Frolik

Written by Vaclav Frolik

Interests:

  • UX design and graphics
  • Databases
  • Product / Project management
  • Web technologies
  • Online marketing

Favorites:

  • Music bands: Pearl Jam, Audioslave, RHCP, Midnight Oil, Alter Bridge...
  • Actors: Kevin, Edward, Jack, Jeff and my kids.
  • Actresses: Kim, Jennifer
  • Sports: MTB, Squash, Football (the one played with feet, not hands)
  • Series: IT Crowd, The Big Bang Theory