(Transferred from: http://www.cnblogs.com/xugang/archive/2011/01/20/1939960.html)
Tools:
Sybase PowerDesigner 12.5
Microsoft SQL Server 2005
First step: Conceptual data Model
Open the PowerDesigner software and design the " Conceptual data Model " (conceptual), which is typically used in the outline design phase.
Design Table Structure
Note: If the Palette (tool panel) is not displayed, you can right-click on the toolbar and select "Palette" (tick)
The design results are as follows:
in Design properties ( field) , three letters (M, P, D) indicate:
M: is empty; (√ means null is not allowed)
P: whether the primary key;
D: Whether it is displayed in the view of the software;
When adding a "relationship" relationship, be aware that:
1. In all entity objects, the name of the attribute cannot be duplicated.
2. When adding referential integrity, the foreign key table does not have to add the primary key field of the primary key table as the foreign key. Because, after you add a "relationship" relationship, and then convert to a physical model, the foreign key table automatically adds the Foreign key field column.
3, when the "relationship" relationship is added, the starting point entity defaults to the primary key table, and the end point entity defaults to the foreign key table . Of course, it can be changed in "relationship".
Step two: Physical data model
Convert the design of the conceptual data Model to the physical data Model , which is equivalenttoconverting from "physical" to "detailed design", That is, the specific implementation of tables and relationships.
Select "Tools"--"Generate physical Data Model ... "can.
Then select SQL Server 2005 database management software:
When you click the "OK" button, a specific implementation of the table, properties, and relationships for the SQL Server 2005 database is generated.
adding a constraint in PowerDesigner
1> to view or set related constraints on a property (field)
2> setting " identity column " (autogrow)
3> Settings "
Default Value”
4> Settings "
Check Constraint”
5> settings
Unique index
The conceptual data model differs from some of the details in the physical data model:
1> in the conceptual model, do not add the related constraints of the table, should add the related constraints of the table in the physical model;
2> only in the physical model will the PowerDesigner display the Database menu item. The database Generation option is only available in the Database menu item (for generating SQL statements);
step three: in SQL Server 2005 Create a database manually in
For example, I manually created the database "Students" Sample in SQL Server 2005.
Fourth step: In the data source ODBC Configure user data sources in
For example, I add a data source for the database "Students" in the user data source.
Fifth step: in SQL Server 2005 Automatically create table structure in
First: the corresponding SQL statements are automatically established according to the physical data Model (physical):
Second: Execute the SQL statement file that it created, and automatically create the data table structure into the SQL Server 2005 database:
After you complete the steps above, refresh the SQL Server 2005 data and you will see the related table structure you created.
of course, the above two steps can be done together:
SimplySelect "Direct Generation" in "Database" and "Database Generation" to:
this way, using PowerDesigner Design SQL Server The basic steps of the database are all done!