PowerDesigner creates tables and exports SQL statements, powerdesignersql
PowerDesigner creates tables and exports SQL statements
Objective: To improve table creation Efficiency
Test Database: orcale
1. Create a physical model.
Right-click workplace, create a new physical model, and specify a database.
2. Create a table
Set field properties
Add field attributes (such as adding field comments)
3. Export and preview SQL statements
The SQL statement of orcale is found to contain double quotation marks, uppercase letters, and a solution is provided later.
You can also choose and configure the SQL script in the Options tab, such as canceling the foreign key and removing the drop statement..
4. Remove double quotation marks
Choose Database> Edit Current DBMS.
Select the General tab, and choose Script> SQL> Fomat> CaseSensitivityUsingQuote.
5. Batch uppercase letter Conversion
Run the Script directly, find the Tools-Excute Commands-Edit/Run Script, or press Ctrl + Shift + X to bring up the Script execution window. Enter the following code.
Convert to uppercase VB Code
Option Explicit ValidationMode = True InteractiveMode = im_Batch Dim mdl 'current model' get current model Set mdl = ActiveModel If (mdl Is Nothing) Then MsgBox "no model Is opened" ElseIf Not mdl. isKindOf (PdPDM. cls_Model) Then MsgBox "the current model is not a PDM" else' call handler ProcessFolder mdl End If 'the handler called Private sub ProcessFolder (folder) dim Tab 'table to be processed for each Tab in folder. tables 'If not Tab. isShortcut then' Tab. code = tab. name 'table name processing, prefix added to the front, lowercase letter Tab. name = UCase (Tab. name) Tab. code = UCase (Tab. code) Dim col 'the column to be processed for each col in Tab. columns 'column names and codes are all in lower case. code = UCase (col. code) col. name = UCase (col. name) next 'end if next' process the view 'dim view' running view' for each view in folder. views 'If not view. isShortcut then 'view. code = view. name 'end if 'Next' recursively enters sub-packages Dim F' sub folder For Each f In folder. packages if not f. isShortcut then ProcessFolder f end if Next end sub
==================================== Gorgeous split line ======================== =====
The following are all possible examples.
6. Conversion between different databases
Case column: orcal-mysql
Practice: Database → Change Current DBMS → select the target Database to be converted
Result:
Then you can use notepad ++ to convert the letters into lowercase letters. Because MySQL is case sensitive.
7. Orcale creates an auto-incrementing primary key
Double-click the table to open the Properties window → select the P primary key check box → double-click the field set as the primary key (double-click the row header) or click the attribute icon above → select sequence under the open window (note that different databases are different, SQL server is the identity check box). If not, click the new button next to it to create a sequence.
8. Import the SQL script to generate the corresponding database table model Diagram
File → Reverse Engineer → Database... → Modify the module name and select DBMS
Using script files → click the icon below (Add Files) to Add an SQL script file → OK
Similarly, the above cases are equally effective for the sqlserver2008 database.
Http://blog.csdn.net/my_nice_life/article/details/52837084