Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 970
whitespy9 Avatar asked Dec 14 '25 09:12

whitespy9


2 Answers

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
like image 77
Calvin Allen Avatar answered Dec 17 '25 02:12

Calvin Allen


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

like image 22
user1904240 Avatar answered Dec 17 '25 01:12

user1904240



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!