Toad World® Forums

Reverse engineering- Naming conventions to captions


Toad 5.5
Microsoft sql Server 2014

I did reverse engineering on one of my databases and I applied naming conventions that I am already using when I convert model from logical to physical. But I don’t see an option to convert naming a for captions.

For example: Name of a column
Caption: UserFirstName

I want to add space between words for my caption
Caption: User First Name
but there is no option to do that. Is there a possibility to do this? I know scripting task can help remove spaces but I don’t know how it can add spaces to it


I’m afraid but Naming convention utility does not support this functionality. It was designed for synchronization between the captions and names.
But there is possibility to do this by the following script. It will find all the entities and attributes and if it find “CamelCaseName” it will change it to “Camel Case Name” (it just adds space before Upper capitals which follows small letters).

Turn on Expert model in Options, go to the menu Expert mode, select Scripting Windows, move your model from the Available Objects (left) to Selected Objects (right), paste the copied script and execute it. Feel free to modify it.

function main()
  var Entity, Attr, OldCaption, NewCaption, OldName;
  var e, a;

  for (e=0; e<Model.Entities.Count; e++)
    Entity = Model.Entities.GetObject(e);
    OldCaption = Entity.Caption;
    NewCaption = renameFunc(OldCaption);
    OldName = Entity.Name;
    if (NewCaption != OldCaption)
      Entity.Caption = NewCaption;
      Entity.Name = OldName;
      Log.Information("Entity '"+Entity.Name+"' has changed caption to '"+NewCaption+"'.");
    for (a=0; a<Entity.Attributes.Count; a++)
      Attr = Entity.Attributes.GetObject(a);
      OldCaption = Attr.Caption;
      NewCaption = renameFunc(OldCaption);
      OldName = Attr.Name;
      if (NewCaption != OldCaption)
        Attr.Caption = NewCaption;
        Attr.Name = OldName;
        Log.Information("Attribute '"+Attr.Name+"' (in entity '"+Entity.Name+"') has changed caption to '"+NewCaption+"'.");

function renameFunc(AName)
  return AName.replace(/([a-z])([A-Z])/g, "$1 $2");