3

I have a relatively large Conceptual Data Model in PowerDesigner. After generating a Physical Data Model and seeing the DBMS data types, I need to update all of data types(NUMBER/TEXT) for each data item.

I'd like to either do a find/replace within the Conceptual Data Model or somehow map to different data types when creating the Physical Data Model. Ex. Change the auto conversion of Text -> Clob, to Text -> NVARCHAR(20).

Thanks!

whitespy9
  • 148
  • 3
  • 10
  • You could consider using domains, for the next time that you need to perform such a global replacement... – pascal Jul 16 '10 at 09:50

3 Answers3

3

I don't know of a 'standard' find & replace, but this will work just the same. Have you ever ran VBScript against one of your models? If not, let me know, but if so, give one of these a try:

For the Conceptual Model:

Set mdl=ActiveModel

FOR EACH TAB IN MDL.Entities
   IF (not tab.isShortcut) THEN
      FOR EACH COL IN TAB.ATTRIBUTES
         IF COL.DATATYPE = "TXT" THEN
            COL.DATATYPE = "VA20"
         END IF
      NEXT
   END IF
NEXT

Basically, it will look at all the attributes of all your entities, and if the datatype is 'TXT' (Text), it will change it to be 'VA20' (Variable Character (20)).

For the physical model:

Set mdl=ActiveModel

FOR EACH TAB IN MDL.Tables
   IF (not tab.isShortcut) THEN
      FOR EACH COL IN TAB.COLUMNS
         IF COL.DATATYPE = "TEXT" THEN
            COL.DATATYPE = "NVARCHAR(20)"
         END IF
      NEXT
   END IF
NEXT
Calvin Allen
  • 4,176
  • 4
  • 31
  • 31
  • No, I haven't run a VBScript against a model yet, but this is exactly what I was looking for. However... I just registered the product as the developer version and no longer can create Conceptual Models and I'm left with my Physical Model. There are no MDL.Entities in the Physical Model and I don't see anything similar. Thoughts? "Object doesn't support this property or method: 'mdl.Entities' (0x800A01B6) At line 3" – whitespy9 Jun 10 '10 at 14:19
2

If you want to change all CLOB to NVARCHAR(20) another easy way to do that is to make sure you are on the main physical diagram and go to Model-> Columns... then sort the list by Data type, highlight all columns with the datatype you want to change. Change the first one in your selection to the new data type and all highlighted columns will be changed

0

From the top of my head:

Open the metamodel editor and change the mapping of data types for the DBMS you are using.

You could to this in the metamodel definition file provided by Sybase, or you could "clone" (save as...) or extend it (and leave the original file unchanged- which is the recommended way)

I could be more specific (exactly how to do this) , however this post is quite old. So I better wait for feedback from the question's author.

knb
  • 9,138
  • 4
  • 58
  • 85