whitespy9
whitespy9

Reputation: 148

Sybase PowerDesigner Change Many (Find/Replace/Convert) Data Item's Data Types

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!

Upvotes: 3

Views: 4332

Answers (3)

user1904240
user1904240

Reputation: 21

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

Upvotes: 2

knb
knb

Reputation: 9295

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.

Upvotes: 0

Calvin Allen
Calvin Allen

Reputation: 4248

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

Upvotes: 3

Related Questions