I wrote a blog for the first time and shared some experience. When using powerdesigner, PD does not add the name item to the comment by default, therefore, the generated database table does not contain comments for Chinese fields.
I checked it online. There is a solution.
The following is an online solution. I have improved it.
'Usage
'Powerdesigner-> Tools-> execute commands-> edit/run scripts
Save the script name2comment. vbs.
' Add the name in the PD to the comment automatically.
' If the comment is empty, enter the name. If it is not empty, the comment remains unchanged. This avoids the loss of existing comments.
Option Explicit
Validationmode = True
Interactivemode = Im_batch
Dim MDL ' The current model
' Get the current active Model
Set MDL = Activemodel
If (MDL Is Nothing ) Then
Msgbox " There is no current Model "
Elseif Not MDL. iskindof (pdpdm. cls_model) Then
Msgbox " The current model is not an physical data model. "
Else
Processfolder MDL
End If
' This routine copy name into comment for each table, each column and each view
' Of the current folder
Private Sub Processfolder (folder)
Dim Tab ' Running table
For Each Tab in folder. Tables
If Not Tab. isshortcut Then If Trim(Tab. Comment)="" Then ' If a table comment exists, it is not changed. If no table comment exists, the name is added to the comment.
Tab. Comment = Tab. Name End If
Dim Col ' Running Column
For Each Col in tab. Columns
If Trim (Col. Comment) = "" Then ' If the col comment is empty, enter the name. If there are comments, do not add them. This avoids the loss of existing comments.
Col. Comment = Col. Name
End If
Next
End If
Next
Dim View ' Running View
For Each View in folder. Views
If Not View. isshortcut And Trim (View. Comment) = "" Then
View. Comment = View. Name
End If
Next
' Go into the sub-packages
Dim F ' Running folder
For Each F In folder. Packages
If Not F. isshortcut Then
Processfolder F
End If
Next
End Sub
After we design the database, execute it again. OK. All the Description fields of your database are available. Is it very convenient!